# Configs

{% tabs %}
{% tab title="config.lua" %}

```lua
Config = {}

Config.Framework = "esx" -- "qb" or "esx"
Config.Core = "qb-core" -- Your qb-core name , if you use ESX ignore this
Config.Notify = "ox" -- "qb" or "okok" or "ox" ( open code on config_functions.lua )
Config.DisableEngine = true -- Disable engine when player is AFK
Config.AFKTime = 300  -- Time in seconds to player be AFK ( 5 minutes )
Config.Debug = true -- Debug mode
Config.BlackBars = true -- Enable blacksbars when player is AFK
Config.Webhooks = true -- Enable or disable discord logs ( webhook can changed on s_utils.lua )
Config.Autodatabase = true -- Auto create database table

Config.CommandAFK = {
    enable = true, -- Enable command to set player AFK?
    command = "afk", -- Command to set player AFK
}

Config.CommandPermissions = {
    command = "checkafk",
    description = "Check all players with bypass to afk",
    permission = "admin", -- Permission to use command
}

Config.WarningAFK = {
    enable = true, -- Enable warning when player is AFK?
    warningMessage = "You will go to AFK in some seconds", -- Warning message
    timeWarning = 280, -- Time in seconds to warning player ( 20 seconds before Config.AFKTime )
}

Config.KickPlayer = {
    enable = true, -- Enable kick player when AFK?
    kickMessage = "You were kicked for being AFK", -- Kick message
    timeToKick = 600, -- Time in seconds to kick player ( 10 Minutes )
    timeWarning = 580, -- Time in seconds to warning player ( 20 seconds before Config.timeToKick )
    warningMessage = "You will be kicked for being AFK in 10 seconds", -- Warning message
}

Config.RemoveHud = {
    enable = false, -- Enable remove hud when player is AFK?
    removeHud = function ()
        -- You can trigger your hud code to disable it when AFK
    end
}

Config.Animation = { -- This animation is only when the player is AFK outside the vehicle
    enable = true, -- Enable animation?
    animDict = "cellphone@", -- Animation dictionary
    animName = "cellphone_text_read_base", -- Animation name
}

Config.Text = {
    enable = true, -- Enable text above the player's head?
    text = "I'am AFK boyyyzzzzz", -- Text above the player's head
}
```

{% endtab %}

{% tab title="config\_functions.lua" %}

```lua
if Config.Framework == "qb" then
    QBCore = exports[Config.Core]:GetCoreObject()
elseif Config.Framework == "esx" then
    ESX = exports.es_extended:getSharedObject()
end

function Notify(msg, type, time)
    if Config.Notify == "standalone" then
        BeginTextCommandThefeedPost("STRING")
        AddTextComponentSubstringPlayerName(msg)
        EndTextCommandThefeedPostTicker(true, true)
    elseif Config.Notify == "qb" then
        QBCore.Functions.Notify(msg, type, time)
    elseif Config.Notify == "okok" then
        exports['okokNotify']:Alert('Notification', msg, time, type, true)
    elseif Config.Notify == "ox" then
        lib.notify({ title = 'Notification', description = msg, type = type })
    end
end

function DrawText3D(x, y, z, text)
    local onScreen, _x, _y = World3dToScreen2d(x, y, z)
    local camCoords = GetGameplayCamCoords()
    local dist = #(vector3(x, y, z) - camCoords)

    local scale = 1 / dist * 2
    local fov = (1 / GetGameplayCamFov()) * 100
    scale = scale * fov

    if onScreen then
        SetTextScale(0.0 * scale, 0.5 * scale)
        SetTextFont(0)
        SetTextProportional(true)
        SetTextColour(255, 255, 255, 215)
        SetTextDropshadow(0, 0, 0, 0, 255)
        SetTextEdge(2, 0, 0, 0, 150)
        SetTextDropShadow()
        SetTextOutline()
        SetTextEntry("STRING")
        AddTextComponentString(text)
        DrawText(_x, _y)
    end
end
```

{% endtab %}

{% tab title="config\_language.lua" %}

```lua
Language = {}

Language = {
    alreadyOnBypass = "This player is already on the bypass list.",
    playerAddedBypass = "Player added to bypass list.",
    failedAddBypass = "Failed to add player to bypass list.",
    invalidId = "Invalid ID.",
    playerRemovedBypass = "Player removed from bypass list.",
    failedRemoveBypass = "Failed to remove player from bypass list.",
    noPlayersInBypass = "No players in bypass list.",
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mscripts.gitbook.io/docs/both-framework/scripts/afk-system/configs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
