# The three tables in ox_inventory’s weapons.lua

> The ox_inventory data/weapons.lua reference: the Weapons, Components and Ammo tables, adding an add-on weapon, custom attachments and common mistakes.

Source: https://fam-tools.com/guides/ox-inventory-weapons-data · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 10 min

**Short answer.** `Weapons` entries are keyed by the weapon name (`WEAPON_PISTOL`) with `label`, `weight` (grams), `durability` (how much each shot wears it), `ammoname` (the ammo item it loads) and flags like `throwable`. `Components` entries are attachment items (`at_suppressor_light`) with a `type` and a `client.component` list of every component hash they can become. `Ammo` entries are the ammo items with label and weight per round.

## Key points

- Weapons keyed by `WEAPON_…`, weight in grams.
- `ammoname` must match an item in the Ammo table.
- One attachment item can map to many component hashes.
- `throwable = true` for grenades and similar.
- Add-on weapons need an entry here and an image.

Every gun, attachment and bullet in an ox_inventory server is defined in one file: `data/weapons.lua`. It has three tables — Weapons, Components and Ammo — and knowing what each field does is the difference between an add-on weapon that works on the first try and one that shows up without ammo or attachments.

## The Weapons table

*data/weapons.lua — Weapons*

```lua
['WEAPON_APPISTOL'] = {
    label = 'AP Pistol',
    weight = 1400,
    durability = 0.1,
    ammoname = 'ammo-9',
},

['WEAPON_SWITCHBLADE'] = {
    label = 'Switchblade',
    weight = 300,
    durability = 0.1,
    anim = { 'anim@melee@switchblade@holster', 'unholster', 200, 'anim@melee@switchblade@holster', 'holster', 600 },
},

['WEAPON_TEARGAS'] = {
    label = 'Tear Gas',
    weight = 600,
    throwable = true,
},
```

| Field | Meaning |
| --- | --- |
| `label` | Display name |
| `weight` | Grams |
| `durability` | Wear per shot (smaller = lasts longer) |
| `ammoname` | Ammo item the weapon loads |
| `throwable` | Thrown weapons (grenades, balls) |
| `anim` | Custom draw/holster animation |

## The Components table

*data/weapons.lua — Components*

```lua
['at_suppressor_light'] = {
    label = 'Suppressor',
    weight = 280,
    type = 'muzzle',
    client = {
        image = 'at_suppressor.png',
        component = {
            `COMPONENT_AT_PI_SUPP`,
            `COMPONENT_AT_PI_SUPP_02`,
            `COMPONENT_CERAMICPISTOL_SUPP`,
            `COMPONENT_PISTOLXM3_SUPP`,
        },
        usetime = 2500,
    },
},
```

When a player uses the item on a weapon, ox_inventory picks the first hash in the list that fits that weapon. To make a vanilla attachment work on an add-on weapon, add the add-on’s component hash to the right list. Attachment details: [ox_inventory attachments](https://fam-tools.com/guides/ox-inventory-weapon-attachments).

## The Ammo table

*data/weapons.lua — Ammo*

```lua
['ammo-9'] = {
    label = '9mm',
    weight = 7,
},
```

Which weapon uses which ammo item is listed in [ammo types and items](https://fam-tools.com/guides/fivem-ammo-types-and-items).

## Adding an add-on weapon

1. Stream the weapon resource and make sure it spawns with `GiveWeaponToPed`.
2. Add a `Weapons` entry with the exact `WEAPON_` name, label, weight, durability and `ammoname`.
3. Add its component hashes to existing attachment items (or new Components entries).
4. Put `WEAPON_NAME.png` — the exact, uppercase item name, like ox_inventory’s own images — in `ox_inventory/web/images/`.
5. Restart the server (data files are loaded at start).

Weapons from our studio export with a ready ox_inventory snippet and item image — see [ox_inventory weapon setup](https://fam-tools.com/guides/ox-inventory-weapon-setup).

## Common mistakes

| Symptom | Cause |
| --- | --- |
| Weapon cannot be reloaded | `ammoname` missing or not an Ammo item |
| Attachment does nothing | Component hash not in the item’s `client.component` list |
| No image in inventory | Image file name does not match the item name |
| Weapon breaks too fast | `durability` too high for its fire rate |

## Questions

### How do I add a weapon to ox_inventory?

Add an entry to the Weapons table in `data/weapons.lua` with the weapon name, label, weight, durability and ammoname, add an image, and restart.

### What does durability mean in weapons.lua?

How much durability each shot costs. Lower values make the weapon last longer.

### How do I make an attachment work on an add-on weapon?

Add the add-on’s component hash to the attachment item’s `client.component` list.

### Is weight in kilograms?

No, in grams.

## Related

- https://fam-tools.com/guides/ox-inventory-weapon-setup
- https://fam-tools.com/guides/ox-inventory-weapon-attachments
- https://fam-tools.com/guides/fivem-ammo-types-and-items
- https://fam-tools.com/guides/fivem-weapon-durability
