> For the complete documentation index, see [llms.txt](https://docs.ak4y.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ak4y.com/scripts/ak4y-map_editor/editable-files/sv_utils.lua.md).

# sv\_utils.lua

```lua
local myframework = nil
WEBHOOK = ""
local Framework = nil

CreateThread(function()
    if not myframework then
        if GetResourceState("qbx_core") == "started" then
            myframework = "qb"
            Framework = exports["qb-core"] and exports["qb-core"]:GetCoreObject() or exports["qbx_core"]:GetCoreObject()
        elseif GetResourceState("es_extended") == "started" then
            myframework = "esx"
            Framework = exports["es_extended"]:getSharedObject()
        elseif GetResourceState("qb-core") == "started" then
            myframework = "qb"
            Framework = exports["qb-core"] and exports["qb-core"]:GetCoreObject() or exports["qbx_core"]:GetCoreObject()
        else
            myframework = "standalone"
        end
    end
end)

function IsPlayerAdmin(playerid)
    for _, identifier in pairs(GetPlayerIdentifiers(playerid)) do
        for _, allowed in ipairs(Config.Permissions) do
            if string.lower(identifier) == string.lower(allowed) then
                return true
            end
        end
    end

    if myframework == "qb" then
        local QBCore = exports["qb-core"] and exports["qb-core"]:GetCoreObject() or exports["qbx_core"]:GetCoreObject()
        if QBCore then
            if Framework.Functions.HasPermission(playerid, "admin") or Framework.Functions.HasPermission(playerid, "god") then
                return true
            end
        end
        return false

    elseif myframework == "esx" then
        local xPlayer = Framework.GetPlayerFromId(playerid)
        if xPlayer and (xPlayer.getGroup() == "admin" or xPlayer.getGroup() == "superadmin") then
            return true
        end
        return false

    else
        return IsPlayerAceAllowed(playerid, "admin")
    end
end

function SendDiscordLog(playerid, action, objname, objid)
    local src = playerid
    local playerName = CORE:GetPlayerName(src)
    embed = {{
        ["color"] = 373247,

        ["fields"] = {
            [1] = {
                ["name"] = "Player Name",
                ["value"] = playerName,
                ["inline"] = true
            },
            [2] = {
                ["name"] = "Action",
                ["value"] = action,
                ["inline"] = true
            },
            [3] = {
                ["name"] = Config.locales[Config.Locale].log.obj_name,
                ["value"] = objname,
                ["inline"] = true
            },
            [4] = {
                ["name"] = Config.locales[Config.Locale].log.obj_id,
                ["value"] = objid,
                ["inline"] = true
            },
        },
    }}
    PerformHttpRequest(WEBHOOK, function() end, 'POST', json.encode({ username = 'HASO LOGS', embeds = embed}), { ['Content-Type'] = 'application/json' })
end
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.ak4y.com/scripts/ak4y-map_editor/editable-files/sv_utils.lua.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
