> For the complete documentation index, see [llms.txt](https://docs.rainmad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rainmad.com/resources/blackmarkets-player-run-contraband-operation/installation.md).

# Installation

{% stepper %}
{% step %}

## Install dependencies

Make sure every resource on the [Dependencies](/resources/blackmarkets-player-run-contraband-operation/dependencies.md) page is installed and starts **before** Blackmarket. At minimum: your framework, `ox_lib`, `oxmysql`, an inventory and a target resource.
{% endstep %}

{% step %}

## Add the resource

1. Download the asset from the FiveM Keymaster (Granted Assets) or your order, and unzip it.
2. Drop the `rm_blackmarkets` folder into your server's `resources` directory (for example `resources/[rainmad]/rm_blackmarkets`).

{% hint style="danger" %}
Do **not** rename the resource folder. It must stay `rm_blackmarkets` — the database tables, state bags and events are all keyed to that name.
{% endhint %}
{% endstep %}

{% step %}

## Start the resource

Add it to your `server.cfg`, after its dependencies:

```cfg
ensure oxmysql
ensure ox_lib
ensure ox_inventory      # or your inventory
ensure ox_target         # or qb-target

ensure rm_blackmarkets
```

{% endstep %}

{% step %}

## Database

There is **nothing to import**. On the first start the resource creates its tables automatically through `oxmysql`:

* `rm_blackmarkets_warehouses`, `rm_blackmarkets_members`, `rm_blackmarkets_inventory`, `rm_blackmarkets_orders`
* `rm_blackmarkets_sales_log`, `rm_blackmarkets_vault_log`, `rm_blackmarkets_audit_log`
* phone tables (only when `cfg.bridge.phone` isn't `false`): `rm_blackmarkets_warehouse_public`, `rm_blackmarkets_conversations`, `rm_blackmarkets_messages`
  {% endstep %}

{% step %}

## Register your items

Every item in `cfg.items` (weapons, ammo, drugs, tools…) must already exist in your **inventory**. Items that are not registered there cannot be ordered, stocked or sold. See [How to Add an Item](/resources/blackmarkets-player-run-contraband-operation/how-to-add-an-item.md).
{% endstep %}

{% step %}

## Grant admin access

By default, anyone with FiveM's built-in `command` ace (the server console, usually `group.admin`) can open the admin panel. To allow specific staff without that ace, add their identifiers to `cfg.admin.allowedIdentifiers`. Then run the command (default `/bm_admin`) in-game to create your first warehouse.

```lua
cfg.admin = {
    command = 'bm_admin',
    allowedIdentifiers = {
        ['license:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'] = true,
    },
}
```

See [Admin Panel](/resources/blackmarkets-player-run-contraband-operation/admin-panel.md) for what the panel can do.
{% endstep %}

{% step %}

## Configure

Open `cfg.lua` and set your framework/target, currency, items, warehouse coordinates, police jobs and the rest. The [Configuration](/resources/blackmarkets-player-run-contraband-operation/configuration.md) page walks through every section.

{% hint style="success" %}
After your first start, type `/bm_admin`, create a warehouse, and assign it an owner.
{% endhint %}
{% endstep %}
{% endstepper %}
