How to add a vehicle

This page explains how to add a new vehicle to a shop

Step 1 - Declare vehicles

First of all you need to declare the vehicles you want to add in the data/vehicles.lua file. You can define multiple time the same vehicle, but make sure to declare a different identifier (The name in the [] parenthesis).

data/vehicles.lua
Config.Vehicles = {
  ['kuruma_1'] = {
    model = 'kuruma',
    label = 'Karin Kuruma',
    price = 50000,
    payMethod = 'money',
    category = 'Sports',
  },

  ['adder_1'] = {
    model = 'adder',
    label = 'Bravado Adder',
    price = 100000,
    payMethod = 'coin',
    category = 'Sports',
  },

  ['kuruma_2'] = {
    model = 'kuruma',
    label = 'Karin Kuruma',
    price = 70000,
    payMethod = 'black_money',
    category = 'Sports',
  },
}

As you can see, the kuruma_1 and kuruma_2 shares the same vehicle model, but they're actually different: kuruma_2 needs 70.000 black_money to be bought, instead of the 20k money for the kuruma_1. So you can define multiple time the same vehicles for different prices or payment methos. Or even category. All is up to your preferences.

Step 2 - Define vehicles in the vehicle shops

After declaring the vehicles in the data/vehicles.lua file, you need to add the vehicle to a vehicle shop from the config.lua file. Go to the Vehicles section of the vehicle shop and simply add you vehicle id (The one defined in the [] parenthesis on the data/vehicles.lua file) and choose in which catalogue it should be (Catalogues are like "pages" or categories) and the actual vehicle position. Position must be a vector4 with X, Y, Z and HEADING.

Config.lua file, under the first vehicle shop table
Vehicles = {
  --[[ 
    Page System: You can set which vehicle will spawn in each "Page".
    This is useful to prevent memory overflow when loading a lot of custom vehicles

    Catalogue: The page number where the vehicle will be displayed. Use a maximum of
    30 vehicles per page to prevent memory overflow and long loading times.
  ]]
  ['adder_1'] = {
    Position = vector4(-2185.93, 1138.90, -24.26, 84.92),
    Catalogue = 'page_1',
  },
  ['kuruma_1'] = {
    Position = vector4(-2185.99, 1135.97, -24.26, 89.04),
    Catalogue = 'page_2',
  },
  ['kuruma_2'] = {
    Position = vector4(-2185.93, 1138.90, -24.26, 84.92),
    Catalogue = 'page_1',
  }
},

Last updated