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

# Editable Files

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

```lua
G9 = {}
zone = nil

for _, events in pairs(cfg.PlayerOnloadEvents) do
    RegisterNetEvent(events)
    AddEventHandler(events, function()
        if cfg.Framework == "qb" then
            player = G9Core.Functions.GetPlayerData()
            PlayerJob = player.job
        else
            playerData = G9Core.GetPlayerData()
            while playerData == nil do
                playerData = G9Core.GetPlayerData()
                Wait(1000)
            end
            if playerData.job ~= nil then
                playerJob = playerData.job.name
                return playerJob
            end
        end
    end)
end




function G9:notify(type,header,msg)
    SendNUIMessage({
        action = 'notify',
        type = type,
        header = header,
        comment = msg
    })
end


for _, data in pairs(cfg.markets) do
    if cfg.useTarget then
        RequestModel(data.model)
        while not HasModelLoaded(data.model) do
            Wait(0)
        end
        local ped = CreatePed(4, GetHashKey(data.model), data.pedCoords.x, data.pedCoords.y, data.pedCoords.z -1, data.pedCoords.w, false, false)
        SetEntityHeading(ped, data.pedCoords.w)
        FreezeEntityPosition(ped, true)
        SetEntityInvincible(ped, true)
        SetBlockingOfNonTemporaryEvents(ped, true)
        SetPedDiesWhenInjured(ped, false)
        SetPedCanRagdoll(ped, false)
        
        if data.job == 'none' then
            if GetResourceState('ox_target') == 'started' then
                local options = {
                    {
                        label = 'Shop',
                        icon = "fas fa-briefcase",
                        onSelect = function()
                            zone = _
                            openShop()
                        end,
                    }
                }
                exports.ox_target:addSphereZone({
                    coords = GetEntityCoords(ped),
                    radius = 0.35,
                    options = options,
                    debug = false,
                })
            else
                exports['qb-target']:AddTargetEntity(ped, {
                    options = {
                        {
                            label = 'Shop',
                            icon = "fas fa-briefcase",
                            action = function()
                                zone = _
                                openShop()
                            end,
                        }
                    },
                    distance = 2.0
                })
            end
        else
            if GetResourceState('ox_target') == 'started' then
                local options = {
                    {
                        label = 'Shop',
                        icon = "fas fa-briefcase",
                        onSelect = function()
                            zone = _
                            openShop()
                        end,
                        groups = data.job
                    }
                }
                exports.ox_target:addSphereZone({
                    coords = GetEntityCoords(ped),
                    radius = 0.35,
                    options = options,
                    debug = false,
                    
                })
            else
                exports['qb-target']:AddTargetEntity(ped, {
                    options = {
                        {
                            label = 'Shop',
                            icon = "fas fa-briefcase",
                            action = function()
                                zone = _
                                openShop()
                            end,
                            job = data.job
                        }
                    },
                    distance = 2.0
                })
            end
        end
    else
        local coord = vector3(data.pedCoords.x, data.pedCoords.y, data.pedCoords.z)
        lib.zones.sphere({
            coords = coord,
            radius = 2,
            onEnter = function()
                lib.showTextUI("[E] Shop")
            end,
            onExit = function()
                lib.hideTextUI()
            end,
            inside = function()
                if IsControlJustPressed(0, 38) then
                    if playerJob == data.job then 
                        lib.hideTextUI()
                        zone = _
                        openShop()
                        lib.showTextUI("[E] Shop")
                    elseif data.job =='none' then
                        lib.hideTextUI()
                        zone = _
                        openShop()
                        lib.showTextUI("[E] Shop")
                    end
                end
            end,
        })
    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, and the optional `goal` query parameter:

```
GET https://gravi9.gitbook.io/documations/scripts/shop/editable-files.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.
