STG ScriptsDocumentation
Vehicle Shop

Configuration

Every option in STG Vehicle Shop config.lua, from shops, dealers and blips to categories, vehicles, colors, test drives, texts and notifications.

All settings live in stg_vehicleshop/config.lua. The file is the same in the ESX and the QBCore version and stays editable in the escrow version. Restart the resource after a change.

Test drive time

STG.testDriveTime = 30

Length of a test drive in seconds. The countdown is shown on the left of the screen. The test drive also ends when the player leaves the vehicle, and the player goes back to the showroom.

Shops

The script ships with three shops: vehicle, air and boat. Each entry describes one shop:

STG.Shops = {
    ["vehicle"] = {
        carSpawnCoord = vector4(404.90100097656, -966.78149414063, -99.004096984863, 43.07537841797),
        vehicleDeliveryCoord = vector4(-48.906772613525, -1077.6535644531, 26.81402015686, 66.28524017334),
        testDriveCoord = vector3(-942.64, -3365.96, 12.95),
        testDrive = true,
        camera = {
            camCoord = vector3(404.01068115234, -962.8, -98.504096984863),
            camRotation = vector3(190.00, 180.00, 15.00),
        },
        blip = {
            label = "Vehicle Shop",
            sprite = 523,
            scale = 0.7,
            color = 3
        },
        npc = {
            coord = vector4(-56.776912689209, -1098.7838134766, 25.422330856323, 28.34657),
            model = "ig_siemonyetarian"
        }
    },
    -- ["air"], ["boat"]
}

Prop

Type

The key of a shop (vehicle, air, boat) decides which categories it sells: a shop shows every category whose type matches its key.

Adding a shop

Copy one of the shop entries in STG.Shops and give it a new key, for example ["truck"].

Set npc.coord to where the dealer should stand and vehicleDeliveryCoord to where bought vehicles should appear. Keep carSpawnCoord and camera as they are to reuse the showroom.

Add the categories this shop should sell to STG.Categories with type set to the new key, and their vehicles to STG.Vehicles. A category belongs to one shop only.

Categories

STG.Categories = {
    ["sedan"] = {
        title = "Sedans",
        image = "sedan.png",
        type = "vehicle"
    },
    -- truck, motorcyle, bike, plane, helicopter, sport, suv, boat
}

The key of a category (sedan) links it to the vehicle list with the same key in STG.Vehicles.

Prop

Type

Vehicles

Vehicles are grouped by category key:

STG.Vehicles = {
    ["sedan"] = {
        ["asea"] = {
            modelName = "asea",
            price = 2000
        },
        -- ...
    },
    -- ...
}

Prop

Type

The name shown in the shop comes from the game's own vehicle name, so add-on vehicles show the name set in their vehicles.meta.

Test drives are switched on or off per shop with testDrive in STG.Shops. The testDrive = false lines on the aircraft and boats in the default file have no effect.

Adding a vehicle

Add an entry under the category it belongs to, with the spawn name as modelName and a price.

Make sure there is an image called <modelName>.webp in stg_vehicleshop/html/images/vehicles/. 775 images of base game vehicles are included. For an add-on vehicle, add your own image with that name.

Colors

STG.Colors = {
    [1] = {
        r = 216,
        g = 217,
        b = 215,
    },
    -- 12 colors by default
}

The swatches in the Color palette, as RGB values from 0 to 255. Players can also pick any other color with the color picker below them.

Texts

The notification and help texts live in stg_vehicleshop/locale/locales.lua, which stays editable in the escrow version:

STG.Locale = {
    open = "Press ~INPUT_CONTEXT~ to open shop",
    success = "you have successfully purchased.",
    noMoney = "you don't have enough money.",
    saved = "You have successfully saved your clothes.",
    notAvailable = "This vehicle is not available for test drive.",
    testDrive = "Test Drive"
}
KeyShown when
openThe player stands next to the dealer
successA purchase goes through
noMoneyThe player cannot pay the price
notAvailableThe player presses Test Drive in a shop with test drives turned off
testDriveTitle above the test drive countdown

saved is not used. The texts inside the shop menu, such as titles and button labels, are in stg_vehicleshop/html/index.html.

Notifications

stg_vehicleshop/notify.lua decides how notifications are shown and stays editable in the escrow version. Replace the body of notify to use your own notification system.

function notify(message)
    ESX.ShowNotification(getMessage(message))
end
function notify(message)
    QBCore.Functions.Notify(getMessage(message))
end

getMessage(message) returns the text for a key from STG.Locale. The same file holds leftNotify, which draws the open help text in the top left corner.

Still having trouble?

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

Get help on Discord

On this page