# Installation

## Installation

### 1. Download Resource

Download the purchased resource from [**CFX Portal**](https://portal.cfx.re/assets/granted-assets) - the official site of FiveM with purchased resources.

***

### 2. Install Required Dependencies

This script needs a few extra resources to work properly.\
Below you will find a list of things to download - click the link, download and upload to your server just like other resources.

<table data-full-width="false"><thead><tr><th width="251">Resource</th><th data-type="content-ref">Download Link</th></tr></thead><tbody><tr><td><strong>oxmysql</strong></td><td><a href="https://github.com/overextended/oxmysql">https://github.com/overextended/oxmysql</a></td></tr><tr><td><strong>ox_lib</strong></td><td><a href="https://github.com/overextended/ox_lib">https://github.com/overextended/ox_lib</a></td></tr><tr><td>ox_target</td><td><a href="https://github.com/overextended/ox_target">https://github.com/overextended/ox_target</a></td></tr><tr><td>ox_inventory</td><td><a href="https://github.com/overextended/ox_inventory">https://github.com/overextended/ox_inventory</a></td></tr></tbody></table>

***

### 3. Import Database Tables

This is a very important step - without it, the script will not work properly.\
Depending on the framework you are using (ESX), select the appropriate section below and **paste the SQL code into your database**.

<details>

<summary>Database for ESX</summary>

```sql
CREATE TABLE IF NOT EXISTS `gunracks` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `coords` LONGTEXT NOT NULL,        -- Coordonnées du râtelier (JSON)
    `rifles` LONGTEXT DEFAULT NULL,    -- Stockage des fusils (JSON)
    `pistols` LONGTEXT DEFAULT NULL,   -- Stockage des pistolets (JSON)
    `taser` TINYINT(1) DEFAULT 0,      -- 1 = a un taser, 0 = non
    `job` VARCHAR(50) DEFAULT NULL     -- Job autorisé à utiliser ce râtelier
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

```

</details>

***

### 4. Add Required Items

The script uses its own items.\
Depending on what inventory you are using, select the appropriate section and add these items to either your item file or database.

<details>

<summary>Items for ox_inventory</summary>

```lua
['gunrack'] = {
  label = 'Gun rack',
  weight = 10000,
  stack = false,
  consume = 0,
  client = {
      export = 'rx_gunrack.placeGunRack',
  },
},
```

</details>

***

### **5. Add Required Items**

The script uses its own custom item.\
\
Depending on the inventory system you are using, add the item to your item file or database.

📁 **Image setup (required)**\
Add the item image to the following directory:

```
ox_inventory/web/images/
```

🖼️ **Image filename:**

```
gunrack.png
```

> Ensure the image name matches exactly, otherwise the item will not display correctly in the inventory UI.

<figure><img src="/files/YIvPEHysgHfIHq69dk0S" alt=""><figcaption></figcaption></figure>

### 6. Environment Requirements### Introduction of door functionality

Go to your **server.cfg** and add:

```nginx
# Dependencies
ensure oxmysql        # MySQL wrapper used for data persistence
ensure ox_lib         # Shared utility library (UI, callbacks, helpers)
ensure ox_target      # Interaction and targeting system
ensure ox_inventory   # Inventory system and item management

# RX Resources
ensure RX_GunRack
```

Ensure there are no syntax errors or incorrect paths in your `server.cfg`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rx-developpement.gitbook.io/rx_developpement-docs/assets/rx_gunrack/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
