> 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/usage-and-permissions.md).

# Usage & Permissions

How players, admins and fee owners use the marketplace.

## Commands

| Command                       | Permission                         | Description                                                                                                                       |
| ----------------------------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `/marketplace`                | Everyone                           | Opens the marketplace. The server checks the player's access and opens the right interface. Name set by `Config.OpenCommand`.     |
| `ace_marketplace_vehiclelock` | Players with a built-in rental key | Locks or unlocks a rented vehicle. Only registered when `Config.Keys.Resource = 'default'`. Usually used through its key mapping. |

The marketplace can also be opened at any `Config.Locations` point (when `UseLocations = true`), or with `Config.OpenKey` / the player's own key binding.

{% hint style="info" %}
**Upgrading from 1.x?** `/marketplaceadmin` and `/marketplacefees` were removed in 2.0.0. `/marketplace` now opens the right tab for everyone.
{% endhint %}

## Who sees what

| Role          | How it's granted                                    | What they get                                                      |
| ------------- | --------------------------------------------------- | ------------------------------------------------------------------ |
| **Player**    | Everyone                                            | Normal marketplace: browse, buy, rent, sell, test drive, earnings. |
| **Admin**     | `Config.Admin.Group` or the `Config.Admin.Ace` ACE  | The **Admin** tab.                                                 |
| **Fee owner** | Identifier in `Config.MarketplaceOwner.Identifiers` | The **Fees** tab for claiming transaction fees.                    |

Staff with both roles start on **Admin** and can switch to **Fees** from the sidebar. Every admin and fee action is also checked on the server, so the tabs can't be unlocked from the client.

## Permissions

### Admins

```lua
Config.Admin = {
    Group = 'admin',
    Ace = 'command.marketplaceadmin',
}
```

How `Group` is checked depends on the framework, based on the adapters in `framework/`:

{% tabs %}
{% tab title="ESX" %}
Admin if `xPlayer.getGroup()` equals `Config.Admin.Group`, **or** the player has the `Config.Admin.Ace` ACE.
{% endtab %}

{% tab title="QBCore" %}
Admin if `QBCore.Functions.HasPermission(source, Config.Admin.Group)` is true, **or** the player has the `Config.Admin.Ace` ACE.
{% endtab %}

{% tab title="Qbox" %}
Qbox permissions are ACE-based. Admin if the player has ACE `Config.Admin.Group` (for example via `add_ace group.admin admin allow`), **or** `qbx_core`'s `HasPermission` returns true, **or** the player has the `Config.Admin.Ace` ACE.
{% endtab %}
{% endtabs %}

To give another group admin access with ACE:

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

```properties
add_ace group.moderator command.marketplaceadmin allow
```

{% endcode %}

Existing `add_ace … command.marketplaceadmin allow` lines from older versions keep working.

### Fee owners

```lua
Config.MarketplaceOwner = {
    Enabled = 'auto',
    Identifiers = {
        'license:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    },
}
```

Accepted formats: `license:xxxx`, the bare license hash, or an ESX identifier such as `char1:xxxx`. Fees are only collected when `Config.TransactionFeePercent` is above `0`.

## Player workflows

{% tabs %}
{% tab title="Selling" %}

1. Store the vehicle in a garage. It must be **stored, not impounded and not spawned**.
2. Open `/marketplace` and go to the **Sell** tab.
3. Select the vehicle, fill in the title, description, category and price.
4. Use **Take Photos** to capture in-game shots (required when photos are required). Photos belong to that vehicle, so picking another vehicle clears them.
5. Publish. When someone buys it, the money goes to your **earnings**, minus the marketplace fee.
   {% endtab %}

{% tab title="Renting out" %}

1. From the **Rent** tab, select a stored vehicle.
2. Set a rental price and rental unit (hour, day, week or month).
3. Publish. When a rental ends, every spawned copy of the vehicle is deleted and it's returned to your garage.
   {% endtab %}

{% tab title="Buying / renting" %}

1. Browse, search and filter the marketplace.
2. Open a listing. **Test drive** it if the seller turned test drives on.
3. Check out: choose **bank or cash** and a **delivery garage** (if available), and confirm the price.
4. The vehicle goes to the chosen garage (or `DefaultGarage`), and keys are handled by the configured [key integration](/docs/jobs-and-economy/p2p-vehicle-marketplace/integrations.md#vehicle-keys).
   {% endtab %}

{% tab title="Earnings" %}
Open the earnings section to see money from sales and rentals and claim it, all at once or in part. Anything that can't be paid immediately is paid on your next login.
{% endtab %}
{% endtabs %}
