STG ScriptsDocumentation
Contract

Configuration

Every option in STG Contract config.lua, from framework, language, item and command to vehicle keys, notifications and vehicle images.

All settings live in stg-contract/config.lua. The file stays editable in the escrow version. Restart the resource after a change.

Framework

Config.Framework = "auto"

Prop

Type

Language

Config.Language = "en"

Available: en, de, fr, es, pt, it, nl, pl, sv, no, fi, ar, he, jp, zh. To change a text, edit the matching file in stg-contract/locales/. The web part of each file holds the texts on the contract itself, the rest are notifications.

Item

Config.Item = "contract"

Prop

Type

Command

Config.Command = {
    active = true,
    needItem = true,
    command = "contract"
}

Prop

Type

The item works whatever these values are.

Vehicle keys

When a sale goes through, the buyer gets the keys from the giveKey function in config.lua. It checks the key resources below in order and uses the first one that is running:

function giveKey(vehicle, plate)
    if GetResourceState('qbx_vehiclekeys') == 'started' then
        TriggerEvent('vehiclekeys:client:SetOwner', plate)
    elseif GetResourceState('qb-vehiclekeys') == 'started' then
        TriggerEvent('vehiclekeys:client:SetOwner', plate)
    -- ...
    end
end
ResourceHow the key is given
qbx_vehiclekeysvehiclekeys:client:SetOwner event
qb-vehiclekeysvehiclekeys:client:SetOwner event
qs-vehiclekeysGiveKeys export
wasabi_carlockGiveKey export
t1ger_keysGiveKey export
mk_vehiclekeysAddKey export
cd_garagecd_garage:AddKeys event
vehicles_keysgiveKeys export
jaksam_vehiclekeysGiveKey export
renzu_vehiclekeysGiveKey export

The function runs on the buyer's client. plate is the sold vehicle's plate and vehicle is the vehicle with that plate within 50 metres of the buyer (nil if it is further away). To use another key script, add an elseif branch with its own call.

Notifications

stg-contract/client/editable/notify.lua sends every message through the framework notification: ShowNotification on ESX and Functions.Notify on QBCore and QBOX. Replace the body of notify to use your own system:

function notify(message, extra)
    local str = ""

    if extra then
        str = " "..extra
    end

    if frameworkName == "esx" then
        Framework.ShowNotification(getMessage(message)..str)
    else
        Framework.Functions.Notify(getMessage(message)..str)
    end
end

getMessage(message) turns the message key into the text from your language file. This file also stays editable in the escrow version.

Vehicle images

On QBCore and QBOX, each vehicle card shows stg-contract/html/images/vehicles/<model>.png, where <model> is the spawn name stored in player_vehicles. Images for 815 vanilla vehicles are included. For an addon vehicle, add a PNG named after its spawn name, for example sultanrs.png.

Still having trouble?

Open a ticket on our Discord. Our team answers around 15 hours a day.

Get help on Discord

On this page