> 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/gta-dual-wield-two-handed-weapons/installation.md).

# Installation

### 1. Drop in the resource

Place the `rm_dualgun` folder in your resources directory and add it to `server.cfg` **after** your framework, `ox_lib` and your inventory:

```cfg
ensure ox_lib
ensure oxmysql
ensure ox_inventory      # or your inventory
ensure rm_dualgun
```

{% hint style="warning" %}
Load order matters. `rm_dualgun` detects your framework and inventory at start time. If it starts first, auto-detection falls back to defaults and ammo silently drops to SQL mode.
{% endhint %}

***

### 2. Add the items

Open the `[items]` folder and copy the block that matches your inventory:

| Inventory                         | File                       | Where it goes                 |
| --------------------------------- | -------------------------- | ----------------------------- |
| ox\_inventory                     | `items - ox_inventory.lua` | `ox_inventory/data/items.lua` |
| qb-inventory / qs / origen / ak47 | `items - qb shared.lua`    | `qb-core/shared/items.lua`    |
| Database-backed inventories       | `items.sql`                | Run against your database     |

Each file contains **39 weapon items** and **10 ammo items**. See Items for the full list and image requirements.

***

### 3. Ammo storage

Nothing to do if your inventory supports metadata. The script detects it and stores ammo on the item.

If it does not, the script falls back to SQL and creates its own table on first start. You can also run it manually:

```sql
CREATE TABLE IF NOT EXISTS dualgun_ammo (
    id VARCHAR(96) NOT NULL,
    weapon_key VARCHAR(64) NOT NULL,
    ammo_left INT UNSIGNED NOT NULL DEFAULT 0,
    ammo_right INT UNSIGNED NOT NULL DEFAULT 0,
    owner VARCHAR(64) NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY idx_owner (owner),
    KEY idx_weapon_key (weapon_key)
);
```

See Ammo System for how the two modes differ.

***

### 4. Verify

Start the server and check the console. You should see one line like:

```
[rm_dualgun] ammo persistence: metadata mode (inventory=ox_inventory)
```

Then in game:

```
/useDual rm_appistol_dual
```

This spawns a dual gun with full ammo, bypassing item ownership. Hold the aim button and both hands should raise with the weapons attached.

{% hint style="info" %}
`/useDual` is a testing command that ignores your inventory. It is the fastest way to confirm animations and attachment work before wiring up items.
{% endhint %}

***

### 5. Controls

| Input             | Action                                      |
| ----------------- | ------------------------------------------- |
| Mouse wheel click | Aim (raises both weapons)                   |
| Left click        | Fire left gun, or both in unified mode      |
| Right click       | Fire right gun, or aim only in unified mode |
| `X`               | Toggle fire mode                            |
| `M`               | Put the dual guns away                      |

Keybinds are registered through `ox_lib`, so players can rebind `X` and `M` in the FiveM keybind settings.
