> 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-drone/editable-files/sv_utils.lua.md).

# sv\_utils.lua

```lua
CORE = exports["ak4y-core"]
local myframework = "qb"

CreateThread(function()
    if GetResourceState("qbx_core") == "started" then
        myframework = "qbx"
    elseif GetResourceState("es_extended") == "started" then
        myframework = "esx"
    elseif GetResourceState("qb-core") == "started" then
        myframework = "qb-core"
    end
end)

CreateThread(function()
    for k,v in pairs(Config.Drones) do
        if v.itemtype == "drone" then
            exports["ak4y-core"]:RegisterUsableItem(v.name, function(source, item)
                if exports["ak4y-core"]:RemovePlayerItem(source, v.name, 1) then
                    if myframework == "qb-core" then
                        TriggerClientEvent('ak4y-drone:client:UseDrone', source, item.info.stats, item.info.abilities, item.info.model, item.info.job, v.name, source, os.date("*t"))
                    else
                        TriggerClientEvent('ak4y-drone:client:UseDrone', source, item.metadata.stats, item.metadata.abilities, item.metadata.model, item.metadata.job, v.name, source, os.date("*t"))
                    end
                end
            end)
        end
    end
end)

CORE:Register('ak4y-drone:GetVehicleOwner', function(source, plate)
    local src = source
    local citizenId = CORE:GetCitizenId(src)
    local sqlResult = CORE:ExecuteSql("SELECT * FROM ".. Config.PlayerVehicles .." WHERE plate = '".. plate .."'")
    if sqlResult[1] then
        local searchidf = sqlResult[1][Config.OwnerIdf]
        local playerResult = CORE:ExecuteSql("SELECT * FROM ".. Config.Players .." WHERE ".. Config.citizenId .. " = '" .. searchidf .. "'")
        if playerResult[1] then
            if myframework == "qb-core" or myframework == "qbx" then
                local charinfo = json.decode(playerResult[1].charinfo)
                local name = charinfo.firstname .. " " .. charinfo.lastname
                return name
            elseif myframework == "esx" then
                local name = playerResult[1].firstname .. " " .. playerResult[1].lastname
                return name
            end
        else
            return false
        end
    else
        return false
    end
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:

```
GET https://docs.ak4y.com/scripts/ak4y-drone/editable-files/sv_utils.lua.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.
