> For the complete documentation index, see [llms.txt](https://risk-scripts.gitbook.io/risk-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://risk-scripts.gitbook.io/risk-scripts/scripts/vehicle-shop/configuration.md).

# Configuration

Breaking down Config.lua, focusing on essential fields and how to customize them.

Below is an **abbreviated** example of <mark style="color:yellow;">`Config.lua`</mark> and associated localizations. Adjust or expand as needed.\
\
**Notable Fields:**

* **`Language`**: Defines which locale block in `Locales` is used for text messages.
* **`Shops`**: Each **shop** entry has a location, NPC configuration, camera positions, test drive coords, and multiple categories.
* **`jobs`**: The job(s) allowed to open the shop. If you have `jobs={"all"}`, anyone can access it.
* **`gradeRange`**: The min and max job grade that can see that category. E.g., `{0,2}` means job grade 0 to 2.
* **`testDriveCoords`** & **`returnCoords`**: Where the player is sent to test the vehicle and then returned.
* **`purchaseSpawnCoords`**: Where the purchased vehicle spawns if `Config.SpawnVehicleOnPurchase` is `true`.
* **`PlateOptions`**: If `useCustomPlateText=true`, all purchased vehicles get the same plate text. Otherwise, the script builds a plate from a prefix, random letters/numbers.
* **`UseOxmysql`**: If `true`, uses `exports.oxmysql`. If `false`, uses `MySQL.Async`.

```lua
Config = {

  Debug = false,
  Language = "en",      -- 'en', 'de', 'fr', 'es', 'it' ...
  UseOxmysql = true,    -- If you rely on oxmysql; else use MySQL.Async
  HideHudEvent = "",    -- Name of event to hide HUD, if desired

  SpeedUnit = "KM/H",   -- or "MP/H"
  WeightUnit = "KG",    -- or "LB"

  SpawnVehicleOnPurchase = true,  -- Instantly spawn purchased vehicle
  SaveVehicleToDatabase = true,   -- Write to DB
  SpawnClean = true,              -- Spawn with 0 dirt level
  SpawnFullFuel = true,           -- Full tank on spawn

  CustomPlateText = "RISKSHOP",   -- Fallback text if not generating random plates
  PlateOptions = {
    useCustomPlateText = false,
    customPlateText    = "RISKSHOP",
    prefix             = "RS",
    letters            = 2,
    numbers            = 3
  },

  MaxStats = {
    Speed   = 200,  -- For in-UI speed percentage
    Weight  = 3000,
    Braking = 100,
    Seats   = 4
  },

  Shops = {
    {
      label  = "Police Shop",
      coords = vector4(459.0816, -1017.2405, 28.1510, 81.7479),
      jobs   = { "police" },
      useMarker = true, markerType = 2, markerScale = { x=0.3, y=0.3, z=0.3 },
      markerColor = { r=0, g=0, b=255, a=150 },
      useNPC   = true,
      npcModel = "s_m_y_cop_01",
      useBlip  = true,
      blip     = { sprite=225, scale=0.8, color=38 },

      previewCoords     = vector4(449.7559, -981.1694, 43.0635, 91.2737),
      cameraCoords      = vector3(449.2968, -992.4048, 45.6916),
      cameraRot         = vector3(-10.0, 0.0, 2.0),

      testDriveCoords   = vector4(-1827.59, -2818.12, 13.31, 149.78),
      returnCoords      = vector4(455.9341, -1016.9967, 28.4024, 267.5273),
      purchaseSpawnCoords = vector4(463.0, -1015.0, 28.15, 90.0),

      defaultZoomDistance = 7.0,
      minZoomDistance     = 5.0,
      maxZoomDistance     = 25.0,

      categories = {
        {
          name = "PATROL (0-2)",
          gradeRange = {0,2},
          vehicles = {
            { spawnName="police", displayName="Police Cruiser", price=100, image="police.png", isElectric=false, livery=0 },
            { spawnName="police2", displayName="Police Buffalo", price=150, image="police2.png", isElectric=false, livery=1 },
            -- more vehicles...
          }
        },
        {
          name = "SPECIAL (3-5)",
          gradeRange = {3,5},
          vehicles = {
            { spawnName="fbi", displayName="FIB SUV", price=300, image="fbi.png", isElectric=false, livery=1 },
            -- more vehicles...
          }
        }
      }
    },
    -- Another shop, e.g. Medic Shop, Public Car Shop, Boat Shop, Airplane Shop ...
  }
}

Locales = {
  ["en"] = {
    pressE         = "Press E to open",
    shopText       = "Vehicle Shop",
    testDriveText  = "TEST DRIVE",
    notEnoughMoney = "You don't have enough money",
    purchasedVehicle = "You purchased the vehicle",
    notAllowed     = "You are not allowed here",
    rankTooLow     = "Your rank is too low",
    exitVehicle    = "Exit your vehicle first"
  },
  ["de"] = {
    pressE = "Drücke E zum Öffnen",
    -- ...
  },
  -- more translations...
}

```
