> 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/car-sell/editable-files.md).

# Editable Files

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

<pre class="language-lua"><code class="lang-lua"><strong>function testdrive(name, properties)
</strong>    local eskicoords = GetEntityCoords(PlayerPedId())
    TriggerServerEvent('test-gir')
    SetEntityCoords(PlayerPedId(), Config.TestDriveCoords)
    CloseMenu()
    Wait(500)
    
    if Config.Framework == 'newqb' or Config.Framework == 'oldqb' then
        ontestdrive = true
        Core.Functions.SpawnVehicle(name, function(veh)
            SetVehicleNumberPlateText(veh, 'TEST')
            SetEntityHeading(veh, Config.TestDriveCoords.w)
            exports[Config.Fuel]:SetFuel(veh, 100)
            TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1)
            TriggerEvent("vehiclekeys:client:SetOwner", Core.Functions.GetPlate(veh))
            SetVehicleEngineOn(veh, true, true)
            if properties then
                Core.Functions.SetVehicleProperties(veh, properties)
            end
            local sayi = 30
            while sayi > 0 do
                Wait(1000)
                if IsPedInAnyVehicle(PlayerPedId()) then
                    sayi = sayi - 1
                else
                    sayi = 0
                end
                testdrivetext = "Last " .. sayi .. " second"
            end
            ontestdrive = false
            DeleteVehicle(veh)
            SetEntityCoords(PlayerPedId(), eskicoords)
            notify(Config.lang.overtestdrive, 'error')
            TriggerServerEvent('test-cik')
        end, Config.TestDriveCoords, true)
    elseif Config.Framework == 'newesx' or Config.Framework == 'oldesx' then
        Core.Game.SpawnVehicle(name, Config.TestDriveCoords, Config.TestDriveCoords.w, function(vehicle)
            ontestdrive = true
            exports[Config.Fuel]:SetFuel(vehicle, 100)
            TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, -1)
            if properties then
                Core.Game.SetVehicleProperties(vehicle, properties)
            end
            local sayi = 30
            while sayi > 0 do
                Wait(1000)
                if IsPedInAnyVehicle(PlayerPedId()) then
                    sayi = sayi - 1
                else
                    sayi = 0
                end
                testdrivetext = "Last " .. sayi .. " second"
            end
            ontestdrive = false
            DeleteVehicle(vehicle)
            SetEntityCoords(PlayerPedId(), eskicoords)
            notify(Config.lang.overtestdrive, true)
            TriggerServerEvent('test-cik')
        end)
    end
end
</code></pre>

{% endtab %}

{% tab title="sv\_config.lua" %}

```lua
Webhooks = {
    ['buyvehicle'] = '',
    ['createad'] = '',
    ['withdrawMoney'] = '',
}
```

{% endtab %}

{% tab title="GetFrameworkObject.lua" %}

```lua
function GetCore()
    local object = nil
    local Framework = Config.Framework

    if Config.Framework == "oldesx" then
        local counter = 0
        while not object  do
            TriggerEvent('esx:getSharedObject', function(obj) object = obj end)
            counter = counter + 1
            if counter == 3 then
                break
            end
            Citizen.Wait(1000)
        end
        if not object then
            print("savana-carsell:Framework is not selected in the config correctly if you're sure it's correct please check your events to get framework object")
        end
    end
    
    if Config.Framework == "newesx" then
        local counter = 0
        local status = pcall(function ()
            exports['es_extended']:getSharedObject()
        end)
        if status then        
            while not object do
                object = exports['es_extended']:getSharedObject()
                counter = counter + 1
                if counter == 3 then
                    break
                end
                Citizen.Wait(1000)
            end
        end
        if not object then
            print("savana-carsell:Framework is not selected in the config correctly if you're sure it's correct please check your events to get framework object")
        end
    end

    if Config.Framework == "newqb" then
        local counter = 0
        local status = pcall(function ()
            exports["qb-core"]:GetCoreObject()
        end)
        if status then
            while not object  do
                object = exports["qb-core"]:GetCoreObject()
                counter = counter + 1
                if counter == 3 then
                    break
                end
                Citizen.Wait(1000)
            end
        end
        if not object then
            print("savana-carsell:Framework is not selected in the config correctly if you're sure it's correct please check your events to get framework object")
        end
    end

    if Config.Framework == "oldqb" then
        local counter = 0

        while  not object do
            counter = counter + 1
            TriggerEvent('QBCore:GetObject', function(obj) object = obj end)
            if counter == 3 then
                break
            end
            Citizen.Wait(1000)
        end
        if not object then
            print("savana-carsell:Framework is not selected in the config correctly if you're sure it's correct please check your events to get framework object")
        end
    end

    if Config.Framework == 'autodetect' then
        local counter = 0
        local breakLoop = false
        Citizen.CreateThread(function()
            while not object do
                counter = counter + 1
                if counter == 3 then
                    breakLoop = true
                    counter = 0
                end
                Citizen.Wait(700)
            end
        end)


        while not object do
            local status = pcall(function ()
                object = exports['es_extended']:getSharedObject()
            end)
            Citizen.Wait(1000)
            break
        end

        if object and Framework == 'autodetect' then
            Framework = 'newesx'
        end

        while not object do
            TriggerEvent('esx:getSharedObject', function(obj) object = obj end)
            if breakLoop then
                break
            end
            Citizen.Wait(1000)
        end

        if object and Framework == 'autodetect' then
            Framework = 'oldesx'
        end

        while not object do
            local status = pcall(function ()
                object = exports["qb-core"]:GetCoreObject()
            end)
            Citizen.Wait(1000)
            break
        end

        if object and Framework == 'autodetect' then
            Framework = 'newqb'
        end

        while not object do
            TriggerEvent('QBCore:GetObject', function(obj) object = obj end)
            if breakLoop then
                break
            end
            Citizen.Wait(1000)
        end

        if object and Framework == 'autodetect' then
            Framework = 'oldqb'
        end

        if not object then
            print("savana-carsell:Framework object couldn't find. Setting chat to standalone")
            Framework = 'standalone'
        else
            print("savana-carsell:Framework object found : ", Framework)
        end
    end

    return object, Framework
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/car-sell/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.
