The three tables in ox_inventory’s weapons.lua
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.
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
['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
['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.
#The Ammo table
['ammo-9'] = {
label = '9mm',
weight = 7,
},Which weapon uses which ammo item is listed in ammo types and items.
#Adding an add-on weapon
- Stream the weapon resource and make sure it spawns with
GiveWeaponToPed. - Add a
Weaponsentry with the exactWEAPON_name, label, weight, durability andammoname. - Add its component hashes to existing attachment items (or new Components entries).
- Put
WEAPON_NAME.png— the exact, uppercase item name, like ox_inventory’s own images — inox_inventory/web/images/. - 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.
#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?
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 do I make an attachment work on an add-on weapon?
client.component list.Is weight in kilograms?
Ready to pick a map?
Twelve themes on three base map styles, $8 each, instant download.
Relevant to what you just read
The tool for this
Twenty theme pairs for ox_lib and ox_inventory From $15, built in the browser, exported as a drop-in resource.