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

# sv\_utils.lua

```lua
local myframework = nil

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

function addVehicleToGarage(player, carData, name)
    local _player = player
    local license = getPlayerLicense(_player)
    local cid = CORE:GetCitizenId(_player)
    if myframework == "qb" then
        CORE:ExecuteSql("INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES ('"..license.."', '"..cid.."', '"..name.."', '"..GetHashKey(name).."', '"..json.encode(carData).."', '"..carData.plate.."', '', '0')")
    else
        CORE:ExecuteSql("INSERT INTO owned_vehicles (owner, plate, vehicle, type, stored) VALUES ('"..cid.."', '"..carData.plate.."', '"..json.encode(carData).."', 'vehicle', '1')")
    end
end

function getPlayerLicense(player)
    local identifiers = GetPlayerIdentifiers(player)
    for _, id in ipairs(identifiers) do
        if string.match(id, 'license') then
            return id
        end
    end
    return nil
end

function IsPlayerAdmin(playerid)
    return IsPlayerAceAllowed(playerid, "admin")
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-giveaway/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.
