> For the complete documentation index, see [llms.txt](https://savana.gitbook.io/savanascripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://savana.gitbook.io/savanascripts/scripts/in-or-not/editable-files.md).

# Editable Files

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

```lua
k = {}

Server = IsDuplicityVersion()

if Server then
    k.RegisterEvent = function(name, fn)
        RegisterNetEvent(('savana-events:%s'):format(name), function(id, ...)
            local src = source
            TriggerClientEvent(('savana-events:%s:%s'):format(name, id), src, fn(src, ...))
        end)
    end

    k.getMoney = function(src, type)
        if cfg.core == 'qb' then
            local player = fw.Functions.GetPlayer(src)
            return player.Functions.GetMoney(type)
        else
            local player = fw.GetPlayerFromId(src)
            if type == 'cash' then
                type = 'money'
            end
            return player.getAccount(type).money
        end
    end

    k.hasEnoughMoney = function(src, val, type)
        local money
        if cfg.core == 'qb' then
            money = k.getMoney(src, type or 'cash')
        else
            money = k.getMoney(src, type or 'money')
        end
        if money >= val then
            return true
        else
            return false
        end
    end

    k.removeMoney = function(src, val, type)
        if cfg.core == 'qb' then
            local player = fw.Functions.GetPlayer(src)
            return player.Functions.RemoveMoney(type, val)
        else
            local player = fw.GetPlayerFromId(src)
            if type == 'cash' then
                type = 'money'
            end
            return player.removeAccountMoney(type, val)
        end
    end

    k.addMoney = function(src, val, type)
        if cfg.core == 'qb' then
            local player = fw.Functions.GetPlayer(src)
            return player.Functions.AddMoney(type, val)
        else
            local player = fw.GetPlayerFromId(src)
            if type == 'cash' then
                type = 'money'
            end
            return player.addAccountMoney(type, val)
        end
    end
else
    local id = GetPlayerServerId(PlayerId())

    k.TriggerServerEvent = function(name, ...)
        local p = promise.new()

        SetTimeout(5000, function()
            p:reject({ err = 'Event not Found!' })
        end)

        local handler = RegisterNetEvent(('savana-events:%s:%s'):format(name, id), function(...)
            p:resolve({ ... })
        end)

        TriggerServerEvent(('savana-events:%s'):format(name), id, ...)

        local data = Citizen.Await(p)
        RemoveEventHandler(handler)
        return table.unpack(data)
    end


    CreateThread(function()
        for a, b in pairs(cfg.locations) do
            RequestModel(b.ped.model)
            while not HasModelLoaded(b.ped.model) do
                Wait(0)
            end
            local ped = CreatePed(0, b.ped.model, b.ped.coords.x, b.ped.coords.y, b.ped.coords.z-1.0, b.ped.coords.w, false, false)
            FreezeEntityPosition(ped, true)
            SetEntityInvincible(ped, true)
            SetBlockingOfNonTemporaryEvents(ped, true)
            TaskStartScenarioInPlace(ped, 'WORLD_HUMAN_CLIPBOARD', true)
        end
    
        for k, v in pairs(cfg.locations) do
            if cfg.useTarget == true then
                exports['qb-target']:AddCircleZone('dealernodeal-' ..k, v.ped.coords, 0.35, {
                    name = 'dealernodeal-' ..k,
                    debugPoly = false,
                }, {
                    options = {
                        {
                            type = "client",
                            action = function()
                                handleUIDisplay()
                            end,
                            icon = v.targeticon,
                            label = v.targetlabel,
                        }
                    },
                    distance = 2,
                })
            else
                while true do
                    local time = 500
                    local playerPed = PlayerPedId()
                    local playerCoords = GetEntityCoords(playerPed)
                    local distance = #(playerCoords - vector3(v.ped.coords.x, v.ped.coords.y, v.ped.coords.z))
                    if not dislay then
                        if distance < 5 then
                            time = 1
                            DrawText3D(v.ped.coords.x, v.ped.coords.y, v.ped.coords.z+1.1, '~w~[~b~E~w~] - '..v.targetlabel, 0.6)
                            if IsControlJustReleased(0, 38) then
                                handleUIDisplay()
                            end
                        end
                    end
                    Wait(time)
                end
            end
        end
    end)
    
    function DrawText3D(x, y, z, text)
        SetTextScale(0.35, 0.35)
        SetTextFont(4)
        SetTextProportional(1)
        SetTextColour(255, 255, 255, 215)
        SetTextEntry('STRING')
        SetTextCentre(true)
        AddTextComponentString(text)
        SetDrawOrigin(x, y, z, 0)
        DrawText(0.0, 0.0)
        local factor = (string.len(text)) / 370
        DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
        ClearDrawOrigin()
    end

end
```

{% endtab %}
{% endtabs %}


---

# 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://savana.gitbook.io/savanascripts/scripts/in-or-not/editable-files.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.
