How to add cars to QBCore, Qbox and ESX

A car can spawn by command as soon as its resource runs. To sell it at a dealership, store it in a garage and give players keys, your framework also needs it in its own vehicle list. Here is where that list lives in QBCore, Qbox and ESX.

  1. 1Install the car first

    Put the car\'s resource in your resources folder and ensure it, then check it spawns with /car <spawn code>. The install guide covers that part; if it won\'t spawn, see car not spawning.

  2. 2QBCore: shared/vehicles.lua

    Add an entry to qb-core/shared/vehicles.lua with the model (the spawn code), name, brand, price, category, type ('automobile' for cars, 'bike' for bikes) and shop — the dealership that sells it, such as 'pdm'. The category has to be one that shop lists in qb-vehicleshop\'s config, or it won\'t show. Restart the server afterwards: shared files are read when it starts.

  3. 3Qbox: qbx_core and qbx_vehicleshop

    Qbox keeps the list in qbx_core/shared/vehicles.lua, keyed by model: mycar = { name, brand, model, price, category, type, hash }, where hash is the model name in backticks. Which dealership sells it is set in qbx_vehicleshop/config/shared.lua: by model under vehicles.models, by category under vehicles.categories, or the default shop — and that shop\'s own categories must include the car\'s category.

  4. 4ESX: the vehicles table

    ESX\'s vehicle shop reads the database. Add a row to the vehicles table with name, model (the spawn code), price and category, where the category exists in vehicle_categories — for example INSERT INTO vehicles (name, model, price, category) VALUES ('My Car', 'mycar', 50000, 'sports');. Restart the vehicle shop afterwards.

  5. 5Garages, keys and ownership

    Bought cars are saved per player — player_vehicles on QBCore and Qbox, owned_vehicles on ESX — and the keys script hands over keys on purchase. If a car spawned by command has no keys, use your keys script\'s give-keys command; that\'s normal for cars that weren\'t bought.

  6. 6Name shows as NULL or the wrong name

    The garage reads the car\'s display name from a text entry for its gameName. Without one you see "NULL" or the raw model name. A client script with AddTextEntry('MYCAR', 'My Car') fixes it — the Vehicle Registrar writes that line and the QBCore, Qbox and ESX entries above straight from the car\'s vehicles.meta.

Every GXD vehicle works on QBCore, Qbox, ESX and standalone, and its spawn code is on its page. Start with the free cars if you want to test the steps first.