> For the complete documentation index, see [llms.txt](https://acestudios.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://acestudios.gitbook.io/docs/jobs-and-economy/p2p-vehicle-marketplace/installation.md).

# Installation

Install ace\_p2pmarketplace on ESX Legacy, QBCore or Qbox.

## Requirements

| Requirement                                                                                                                                                        | Required | Notes                                                                                                                                      |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------: | ------------------------------------------------------------------------------------------------------------------------------------------ |
| [ESX Legacy](https://github.com/esx-framework/esx_core), [QBCore](https://github.com/qbcore-framework/qb-core) or [Qbox](https://github.com/Qbox-project/qbx_core) |     ✅    | Auto-detected.                                                                                                                             |
| [oxmysql](https://github.com/overextended/oxmysql)                                                                                                                 |     ✅    | Declared as a dependency.                                                                                                                  |
| **OneSync**                                                                                                                                                        |     ✅    | Test drives, rental returns and spawn checks use server-side entity natives.                                                               |
| [screenshot-basic](https://github.com/citizenfx/screenshot-basic)                                                                                                  | Optional | Only for vehicle photos.                                                                                                                   |
| Garage resource                                                                                                                                                    | Optional | `okokGarage`, `esx_garage`, `qb-garages`, `qbx_garages`. Anything else works through plain vehicle-table updates (with a startup warning). |
| Vehicle keys resource                                                                                                                                              | Optional | `qbx_vehiclekeys`, `qb-vehiclekeys`, `wasabi_carlock`, `qs-vehiclekeys`, `MrNewbVehicleKeys`, `Renewed-Vehiclekeys`                        |

## Steps

{% stepper %}
{% step %}

### Place the resource

Copy `ace_p2pmarketplace` into your `resources` directory.
{% endstep %}

{% step %}

### Import the database

Import **`sql/install.sql`** into your database. It needs your framework's vehicle table (`owned_vehicles` or `player_vehicles`) to exist already.

{% hint style="success" %}
**Updating from an older version?** You don't need to import anything. Missing tables and columns are added automatically on start.
{% endhint %}
{% endstep %}

{% step %}

### Configure `server.cfg`

Start the marketplace **after** your framework, `oxmysql`, garage and key resources, and `screenshot-basic`. Detection only sees resources that are already started.

{% code title="server.cfg" %}

```properties
set onesync on

ensure oxmysql
ensure qb-core            # or es_extended / qbx_core
ensure qb-garages         # your garage resource (optional)
ensure qb-vehiclekeys     # your keys resource (optional)
ensure screenshot-basic   # optional, for photos

ensure ace_p2pmarketplace
```

{% endcode %}
{% endstep %}

{% step %}

### Add secrets to `server.cfg` (optional)

`config.lua` is downloaded by every player, so API keys and webhooks go in **`server.cfg`**:

{% code title="server.cfg" %}

```properties
set ace_marketplace_fivemanage_key "your-fivemanage-api-key"
set ace_marketplace_discord_webhook "https://discord.com/api/webhooks/..."
set ace_marketplace_debug true   # optional: detailed logging
```

{% endcode %}

{% hint style="danger" %}
Use **`set`**, never `setr`. `setr` replicates the value to every player.
{% endhint %}
{% endstep %}

{% step %}

### Set your marketplace locations

Edit `Config.Locations` in `config.lua`. See [Configuration → Access](/docs/jobs-and-economy/p2p-vehicle-marketplace/configuration.md#marketplace-access).
{% endstep %}

{% step %}

### Start and check the console

Start the server and look for the **`[ACE VEHICLE MARKET] [CONFIG] detected settings`** block. If the framework or database can't be set up, the marketplace stays **disabled** and the console says exactly why.
{% endstep %}
{% endstepper %}

## Optional extras

<details>

<summary>Add your server logo</summary>

Replace `web/assets/branding/server_logo.png` with your logo and **keep the file name**. It appears at the top of the marketplace sidebar. Any size or aspect ratio is scaled to fit, and a transparent PNG looks best. Delete the file to show the default mark.

This file is excluded from the integrity check, so replacing it is safe.

</details>

<details>

<summary>Add vehicle preview images</summary>

Put images in `web/assets/images/<model>.png`. Vehicles without an image use `default.png`.

</details>

<details>

<summary>Set a default open key</summary>

Set `Config.OpenKey` (for example `'F5'`). It's unbound by default so it doesn't clash with job menus. Players can bind it in **Settings → Key Bindings → FiveM**.

</details>

<details>

<summary>Allow several test drives at once</summary>

Add spawn points to `Config.TestDrive.SpawnLocations`.

</details>

<details>

<summary>Renamed vehicle-table columns</summary>

Edit `Config.ESXVehicleTable` or `Config.QBVehicleTable`. See [Configuration → Vehicle tables](/docs/jobs-and-economy/p2p-vehicle-marketplace/configuration.md#vehicle-table-columns-advanced).

</details>

## Updating

1. Download the new version from the [Cfx Portal](https://portal.cfx.re).
2. Keep your `config.lua`, `locales/` edits and `web/assets/branding/server_logo.png`.
3. Replace the other resource files. Database changes are applied automatically on start.
4. Back up your database before updating.

When a newer version is available, the server console prints a `[VERSION]` notice on start.
