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

# Installation

Vehicle dealerships for ESX Legacy, with a showroom, a paint picker, test drives, sell back at a spot and player to player sales through a contract item.

### Dependencies

* es\_extended (ESX Legacy)
* ox\_lib
* oxmysql
* ox\_target, only if you switch a dealership to `interaction = 'target'`

{% hint style="warning" %}
Keep the folder named `l-vehicleshop`. The script checks its own name on start and refuses to run when renamed, because events, callbacks and the update check depend on the name.
{% endhint %}

### Steps

1. Drop the `l-vehicleshop` folder into your `resources` directory.
2. Import `sql/l_vehicleshop.sql` once. It only adds the contract item to your `items` table and creates no tables of its own. Bought cars go into the ESX `owned_vehicles` table you already have.
3. Add it to your `server.cfg`, after es\_extended, ox\_lib and oxmysql:

   ```
   ensure l-vehicleshop
   ```

   If the folder sits inside a bracket folder that is already ensured, no extra line is needed.
4. Open `config.lua` for the dealerships and `catalog.lua` for the cars they sell.

### Running ox\_inventory

With ox\_inventory the `items` table is not used, so the SQL file does nothing for you. Add the item to `ox_inventory/data/items.lua` instead, under the same name you set in `Config.Contract.item`:

```lua
['vehicle_contract'] = {
    label = 'Vehicle Contract',
    description = 'Sell your own vehicle to another player.',
    weight = 10,
    stack = true,
    close = true,
},
```

### Startup check

On start the script reads `config.lua` and `catalog.lua` once and prints in yellow whatever looks wrong: categories a dealership shows that do not exist, cars nobody can see, dealerships without cars, and every model the game does not know. That last one is the usual reason an addon car does not spawn. It stays quiet when everything is fine, and `Config.StartupCheck` turns it off.
