STG ScriptsDocumentation
Vehicle Shop 2

Vehicles and Categories

How to add base game and add-on vehicles, vehicle images, categories, job vehicles and whole new shops to STG Vehicle Shop 2.

Everything on this page is done in stg-vehicleshop/config.lua and the stg-vehicleshop/html/images/ folder. Both stay editable in the escrow version. Restart the resource after a change.

Add a vehicle

Add a line to the vehicles list of a category in Config.Categories:

{
    id = "sports",
    label = "Sports",
    vehicles = {
        {name = "pariah", price = 1420000},
        {name = "sultan", price = 45000},
    }
},
  • name is the spawn name of the vehicle.
  • price is what the player pays from cash or bank.

The menu lists vehicles in the order they are written. The same vehicle can sit in several categories with a different price in each.

The name on the card comes from the game: the text label of the model, or its raw display name when the model has no text label.

Add-on vehicles

Stream the vehicle

Make sure the resource that streams the add-on vehicle starts before stg-vehicleshop and that the vehicle spawns in game with its spawn name.

Add it to a category

Add {name = "yourcar", price = 50000} to a category as shown above.

Add the image

Place yourcar.png in stg-vehicleshop/html/images/vehicles/. The file name must match the spawn name exactly. The included images are 640 x 360. Without an image the card shows no picture.

Add a category

Add a new block to the vehicle list of a shop type:

car = {
    -- ...
    {
        id = "muscle",
        label = "Muscle",
        vehicles = {
            {name = "dominator", price = 35000},
            {name = "gauntlet", price = 32000},
        }
    },
},

Then place a muscle.png icon in stg-vehicleshop/html/images/categories/. The file name must match the id. The included icons are 50 x 50.

Job vehicles

A shop with a job block in Config.VehicleShops opens only for players with that job. Inside its categories, min_grade sets the lowest job grade that may buy a vehicle:

police = {
    {
        id = "police",
        label = "Police",
        vehicles = {
            {name = "police", price = 50000, min_grade = 1},
            {name = "police4", price = 80000, min_grade = 3},
            {name = "policeb", price = 90000, min_grade = 4},
        }
    },
},

Players below the grade can still see the vehicle, but buying it fails with "Your job grade is not enough for this vehicle." Leave min_grade out to let every grade buy it. Set price = 0 to hand the vehicle out for free.

Add a new shop

A shop needs two things: an entry in Config.VehicleShops and a vehicle list in Config.Categories under the same name as its type. This example adds a mechanic shop:

Add the vehicle list

Config.Categories = {
    -- ...
    mechanic = {
        {
            id = "tow",
            label = "Tow Trucks",
            vehicles = {
                {name = "towtruck", price = 25000, min_grade = 0},
                {name = "flatbed", price = 40000, min_grade = 2},
            }
        },
    },
}

Add the shop

Copy an existing entry in Config.VehicleShops, set type = "mechanic" and change the coordinates:

{
    type = "mechanic",
    coord = vec4(-211.5, -1324.0, 30.9, 90.0),

    job = {
        active = true,
        name = "mechanic",
    },

    blip = {
        active = false,
        label = "Mechanic Shop",
        sprite = 446,
        color = 5,
        scale = 0.7
    },

    style = "npc",
    npc = "a_m_y_business_01",
    marker = {
        type = 1,
        color = {0, 255, 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(-205.0, -1310.0, 31.0, 0.0)
    },
    camera = {
        camCoord = vector3(404.01068115234, -962.8, -98.504096984863),
        camRotation = vector3(190.00, 180.00, 15.00),
    }
},

Keeping the included show and camera values reuses the underground showroom. Leave out the job block for a shop open to everyone.

Add the category icon

Place tow.png in stg-vehicleshop/html/images/categories/, and an image in html/images/vehicles/ for any vehicle that does not have one yet.

Bought vehicles are saved to player_vehicles or owned_vehicles like any other owned vehicle, so a job shop sells vehicles the player keeps. Use min_grade and the price to control who gets what.

Still having trouble?

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

Get help on Discord

On this page