# Installation

## 3M Shops V2 - Installation

This guide covers how to install the script on a FiveM server.

### 1. Requirements

Required:

* `ox_lib` (loaded directly via `@ox_lib/init.lua`)
* `oxmysql` (the script uses `exports.oxmysql:*`)
* one framework:
  * `es_extended`, or
  * `qb-core`, or
  * `qbx_core`
* one target system:
  * `ox_target`, or
  * `qb-target`

Optional:

* inventory:
  * `ox_inventory` (recommended), or
  * `qb-inventory`
* notifications:
  * `okokNotify`, `ox_lib`, `qb-core/qbx_core`, or `es_extended` fallback
* vehicle keys:
  * `qb-vehiclekeys`, or
  * `wasabi_carlock`

### 2. Copy the resource

Place the `3M_ShopsV2` folder in your `resources` directory.

### 3. Import the database

Import `database.sql` into your MySQL database.

The SQL import should create these tables:

* `player_shops`
* `player_shop_deliveries`

### 4. Server.cfg dependency order

In `server.cfg`, ensure dependencies start before this resource, for example:

```cfg
ensure oxmysql
ensure ox_lib

ensure es_extended
# or qb-core / qbx_core

ensure ox_target
# or qb-target

ensure ox_inventory
# optional: qb-inventory

ensure 3M_ShopsV2
```

### 5. Admin permissions (recommended)

The script uses ACE and framework admin checks. A custom ACE is recommended:

1. In `shared/config.lua`, set:

```lua
Config.AdminAce = 'playerShops.admin'
```

2. In `server.cfg`, add:

```cfg
add_ace group.admin playerShops.admin allow
add_principal identifier.license:YOUR_LICENSE_HERE group.admin
```

### 6. Restart and verification

After restarting the server, verify:

* the resource is `started`
* no `oxmysql`/`ox_lib` errors appear
* admin commands work:
  * `/createshop`
  * `/checkshops`

If all good, continue with `configuration.md` and `usage.md`.
