# Functions

```lua
------------- 
--- Help Text
-------------
function showHelpText(text)
    SetTextComponentFormat("STRING")
    AddTextComponentString(text)
    DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end

------------- 
--- Notify
-------------
function Notify(msg, type)
    if type == "primary" then
        lib.notify({ title = 'Notification', description = msg, type = 'inform' })
    elseif type == "error" then
        lib.notify({ title = 'Notification', description = msg, type = 'error' })
    elseif type == "success" then
       lib.notify({ title = 'Notification', description = msg, type = 'success' })
    end
end


function SpawnVehicle(model)
    local coords = {
        x = 137.92,
        y = -3023.74,
        z = 7.04,
        w =  270.38,
    }

    ESX.Game.SpawnVehicle(model, coords, 100.0, function(veh)
        SetVehicleNumberPlateText(veh, "TUNNERS")
        SetEntityHeading(veh, 274.67)
        TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1)
        SetVehicleFuel(veh, 100.0)
        SetEntityAsMissionEntity(veh, true, true)
        TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1)
        SetVehicleEngineOn(veh, true, true)
    end)
end

RegisterNetEvent(Config.Prefix..":Client:ReturnVehicle", function()
    local InVehicle = IsPedInAnyVehicle(PlayerPedId())
    if InVehicle then
        ESX.Game.DeleteVehicle(GetVehiclePedIsIn(PlayerPedId()))
    end
end)


-------------------- Functions

function CleanVehicle(vehicle)
    local ped = PlayerPedId()
    local pos = GetEntityCoords(ped)
    TaskStartScenarioInPlace(ped, "WORLD_HUMAN_MAID_CLEAN", 0, true)
    lib.progressBar({
        duration = 10000,
        label = ProgressBars["LimparVeiculo"],
        useWhileDead = false,
        canCancel = false,
        disable = {
            car = true,
            move = true,
            cobat = true,
        },
    }) 
    Notify(Language["VeiculoLimpoComSucesso"])
    SetVehicleDirtLevel(vehicle, 0.1)
    SetVehicleUndriveable(vehicle, false)
    WashDecalsFromVehicle(vehicle, 1.0)
    TriggerServerEvent(Config.Prefix..":Server:RemoveItem", "cleaningkit", 1)
    ClearAllPedProps(ped)
    ClearPedTasks(ped)  
end

-------------------- Commands
RegisterCommand("cleanvehicle", function()
    CleanVehicle(vehicle)
end)

function Duty()
    -- You can change the event to your duty
end
```


---

# Agent Instructions: 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://mscripts.gitbook.io/docs/esx/jobs/esx-tunerjob/config/functions.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.
