# vehicle entry structure

Each entry inside a location's `Vehicles` table defines one vehicle that can be spawned from that garage.

## Fields

| Field              | Type                         | Required | Description                                                                                                                                                                                                |
| ------------------ | ---------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `VehicleName`      | `string`                     | Yes      | Display name shown on the menu button.                                                                                                                                                                     |
| `VehicleSpawnName` | `string`                     | Yes      | The spawn model name used by QBCore. Must match the vehicle's registered model key.                                                                                                                        |
| `Grade`            | `number`                     | Yes      | Minimum job grade required to see this vehicle. Use `0` to allow all grades.                                                                                                                               |
| `livery`           | `number`                     | Yes      | <p>Livery index applied on spawn. Use <code>0</code> for the default livery.<br>If the vehicle has no native liveries, the script falls back to mod slot 48 and applies <code>livery - 1</code>.</p>       |
| `colors`           | `table {primary, secondary}` | Yes      | <p>GTA color indices for primary and secondary paint.<br>Example: <code>{0, 0}</code> = black/black, <code>{27, 27}</code> = red/red.<br>Pass <code>{0, 0}</code> if you don't need custom colors.</p>     |
| `extras`           | `table`                      | Yes      | <p>List of extra indices to <strong>enable</strong> on spawn. All other extras present on the vehicle are disabled first.<br>Pass an empty table <code>{}</code> to skip extra configuration entirely.</p> |

## How livery is applied

1. The script checks `GetVehicleLiveryCount(veh)`.
2. If the count is greater than 0, it calls `SetVehicleLivery(veh, livery)`.
3. Otherwise it checks `GetNumVehicleMods(veh, 48)` (the livery mod slot) and calls `SetVehicleMod(veh, 48, livery - 1, false)`.

## How extras are applied

1. All extras from index 0 to 12 that exist on the vehicle are **disabled**.
2. Each index listed in the `extras` table is then **enabled**.

## Examples

```lua
-- Basic police car, all grades, no livery, black paint, extras 1-4 enabled
{ VehicleName = 'Police Car 1', VehicleSpawnName = 'polbmwm3', Grade = 0, livery = 0, colors = {0,0}, extras = {1,2,3,4} },

-- Supervisor vehicle, grade 3+ only, livery 2, all 7 extras enabled
{ VehicleName = 'Supervisor SUV', VehicleSpawnName = 'nfsexpl', Grade = 3, livery = 2, colors = {0,0}, extras = {1,2,3,4,5,6,7} },

-- Gang car, orange paint (color index 38), no extras
{ VehicleName = 'ATK Buffalo', VehicleSpawnName = 'buffalo2', Grade = 0, livery = 0, colors = {38,38}, extras = {} },

-- Helicopter, no extras needed
{ VehicleName = 'Police Heli', VehicleSpawnName = 'polmav', Grade = 0, livery = 0, colors = {0,0}, extras = {} },
```

## Common GTA color indices

| Index | Color     |
| ----- | --------- |
| 0     | Black     |
| 4     | Dark gray |
| 27    | Red       |
| 38    | Orange    |
| 52    | Green     |
| 64    | Blue      |
| 88    | Yellow    |
| 111   | White     |
| 145   | Purple    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mohssins.gitbook.io/mohscriptsdocs/moh-jobgarage/vehicle-entry-structure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
