> 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/wheel-spin/editable-files.md).

# Editable Files

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

```lua
if Config.framework == "esx" then
    ESX = exports["es_extended"]:getSharedObject()
else
    QBCore = exports['qb-core']:GetCoreObject()
end

if Config.framework == "esx" then
    RegisterNetEvent('esx:playerLoaded', function(player)
        RequestModel(Config.props.prop)
        while not HasModelLoaded(Config.props.prop) do
            RequestModel(Config.props.prop)
            Citizen.Wait(0)
        end
        for scripts,savana in pairs(Config.props["coordinat"]) do
        spinmachine = CreateObject(GetHashKey(Config.props.prop), savana.x, savana.y, savana.z, 0, 0, 1)
        FreezeEntityPosition(spinmachine, true)
        SetEntityHeading(spinmachine, savana.w)
        PlaceObjectOnGroundProperly(spinmachine)
        end
    end)
elseif Config.framework == "qb" then
    RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
        RequestModel(Config.props.prop)
        while not HasModelLoaded(Config.props.prop) do
            RequestModel(Config.props.prop)
            Citizen.Wait(0)
        end
        for scripts,savana in pairs(Config.props["coordinat"]) do
        spinmachine = CreateObject(GetHashKey(Config.props.prop), savana.x, savana.y, savana.z, 0, 0, 1)
        FreezeEntityPosition(spinmachine, true)
        SetEntityHeading(spinmachine, savana.w)
        PlaceObjectOnGroundProperly(spinmachine)
        end
    end)
end

CreateThread(function()
    
  if Config.useTarget then 
        exports['qb-target']:AddTargetModel(GetHashKey(Config.props.prop), {
        options = {
            {
                type = "client",
                event = "spin1Event",
                icon = "fas fa-gamepad",
                label = Config.props.spin1label,
                price = 0,
            },
            {
                type = "client",
                event = "spin2Event",
                icon = "fas fa-gamepad",
                label = Config.props.spin2label,
                price = 0,
            },
        },
        distance = 2.5
    })
    
   else 
        while true do
            Wait(0)
            for scripts,savana in pairs(Config.props["coordinat"]) do
                if Vdist(GetEntityCoords(PlayerPedId()), savana.x, savana.y, savana.z) < 3 then
                    spinmachine = GetClosestObjectOfType(savana.x, savana.y, savana.z, 1.5, GetHashKey(Config.props.prop), 0, 0, 0)
                        if DoesEntityExist(spinmachine) then
                            drawText3D(savana.x, savana.y, savana.z, '[E] Game Of Three | [F] Single Game')
                            if IsControlJustReleased(0,38) then
                                TriggerEvent('spin1Event')
                            elseif IsControlJustReleased(0, 49) then
                                TriggerEvent('spin2Event')
                            end
                        end
                    else
                        exports['qb-core']:HideText()
                    end
                end
            end
        end
end)

drawText3D = function(x, y, z, str, length, r, g, b, a)
    local onScreen, _x, _y = GetScreenCoordFromWorldCoord(x, y, z)
    if onScreen then
        local factor = #str / 370
        if length then
            factor = #str / length
        end
        SetTextScale(0.30, 0.30)
        SetTextFont(4)
        SetTextProportional(1)
        SetTextColour(r or 255, g or 255, b or 255, a or 215)
        BeginTextCommandDisplayText('STRING')
        SetTextCentre(1)
        AddTextComponentSubstringPlayerName(str)
        EndTextCommandDisplayText(_x, _y)
        DrawRect(_x, _y + 0.0120, 0.006 + factor, 0.024, 0, 0, 0, 155)
    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/wheel-spin/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.
