STG ScriptsDocumentation
Vehicle Shop 2

Configuration

Every option in STG Vehicle Shop 2 config.lua, from shops, NPCs and cameras to plates, test drives, driving licenses, vehicle keys and fuel.

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

Language

Config.Language = "en"

Available: en, de, fr, es, pt, it, nl, pl, sv, no, fi, cs, ar, he, jp, zh. To change a text, edit the matching file in stg-vehicleshop/locales/. The texts of the shop menu are in the ui block of the same file.

General

Config.Framework = "auto"
Config.Target = "auto"
Config.maxSpeed = 200
Config.testDriveTime = 60
Config.Debug = true

Prop

Type

Driving license

Config.DrivingLicense = {
    active = false,
    license = "driver",
}

Prop

Type

The license check runs for every shop, including boats, helicopters and planes.

HUD

Config.HudFunctions = {
    ["HideHud"] = function()
        -- here hide export for hud
    end,

    ["ShowHud"] = function()
        -- here show export for hud
    end,
}

HideHud runs when the shop menu opens or a test drive ends, ShowHud runs when the menu closes or a test drive starts. Put your HUD's hide and show exports here so it does not cover the menu.

Plates

Config.Plate = {
    customPlate = true,
    price = 500,
    onlyNumbers = false,
    length = {
        min = 5,
        max = 8,
    }
}

Prop

Type

A custom plate is refused when it is too short, too long, contains anything other than digits while onlyNumbers is on, or is already used in player_vehicles (QBCore, QBOX) or owned_vehicles (ESX). While customPlate is on, a player who buys without a custom plate gets a random plate between min and max characters.

Vehicle keys

Config.GiveKey = function(vehicle, plate)
    if GetResourceState('qbx_vehiclekeys') == 'started' then
        TriggerServerEvent('stg-vehicleshop:server:giveKeys', VehToNet(vehicle))
    elseif GetResourceState('qb-vehiclekeys') == 'started' then
        TriggerEvent("vehiclekeys:client:SetOwner", plate)
    elseif GetResourceState('wasabi_carlock') == 'started' then
        exports.wasabi_carlock:GiveKey(plate)
    else
        -- add other key systems here
    end
end

Runs on the client after a purchase and at the start of every test drive. The first key script that is running is used:

Key scriptHow the key is given
qbx_vehiclekeysThe server gives the key with exports.qbx_vehiclekeys:GiveKeys(source, vehicle)
qb-vehiclekeysClient event vehiclekeys:client:SetOwner with the plate
wasabi_carlockexports.wasabi_carlock:GiveKey(plate)

For any other key script, replace the comment in the else branch with its client export or event. vehicle is the spawned vehicle and plate its plate.

Fuel

Config.Functions = {
    ["setFuel"] = function(vehicle)
        -- stg-vanaheimfuel, ox_fuel, LegacyFuel, cdn-fuel, ps-fuel, stg-fuel
        -- Fallback: native
    end,
}

Fills the tank to 100 on bought and test drive vehicles. The first running fuel script from this list is used: stg-vanaheimfuel, ox_fuel, LegacyFuel, cdn-fuel, ps-fuel, stg-fuel. Without any of them, the fuel level is set with the game natives. Add your own fuel script at the top of the function the same way.

Colors

Config.Colors = {
    {r = 216, g = 217, b = 215},
    {r = 253, g = 142, b = 39},
    -- ...
}

Swatches in the Colors section of the menu, as RGB values from 0 to 255. A picked color paints the showroom vehicle, the test drive vehicle and the bought vehicle, as both primary and secondary color. Add or remove lines to change the swatches.

Shops

Each entry in Config.VehicleShops is one shop. Six shops are included: car, boat, helicopter, plane, police and ambulance.

Config.VehicleShops = {
    {
        type = "car",
        coord = vec4(-56.776912689209, -1098.7838134766, 25.422330856323, 28.34657),

        blip = {
            active = true,
            label = "Vehicle Shop",
            sprite = 523,
            color = 3,
            scale = 0.7
        },

        style = "npc",
        npc = "a_m_y_business_01",
        marker = {
            type = 1,
            color = {255, 0, 0},
            scale = {1.0, 1.0, 1.0}
        },

        spawn = {
            show = vec4(404.90100097656, -966.78149414063, -99.004096984863, 43.07537841797),
            testDrive = vec4(-942.64, -3365.96, 12.95, 25),
            delivery = vec4(-51.2891, -1075.1237, 26.5321, 70.5018)
        },
        camera = {
            camCoord = vector3(404.01068115234, -962.8, -98.504096984863),
            camRotation = vector3(190.00, 180.00, 15.00),
        }
    },
    -- ...
}

Prop

Type

All included shops use the same underground showroom for show and camera. To build a new showroom, place the camera first, then move show until the vehicle sits in the middle of the screen.

Categories

Config.Categories = {
    car = {
        {
            id = "sports",
            label = "Sports",
            vehicles = {
                {name = "pariah", price = 1420000},
                -- ...
            }
        },
        -- ...
    },
    police = {
        {
            id = "police",
            label = "Police",
            vehicles = {
                {name = "police", price = 50000, min_grade = 1},
                -- ...
            }
        },
    },
    -- boat, helicopter, plane, ambulance
}

Each key (car, boat, helicopter, plane, police, ambulance) is the vehicle list of the shops with that type. Categories show in the menu in the order they are written.

Prop

Type

Step by step guides for adding vehicles, add-on vehicles, categories and new shops are on Vehicles and Categories.

Still having trouble?

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

Get help on Discord

On this page