Inventoryintermediate10 min readupdated 11 Sept 2026

The three tables in ox_inventory’s weapons.lua

The 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.

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 three tables in ox_inventory’s weapons.lua — illustrated with a FiveM-compatible minimap render

#The Weapons table

data/weapons.lua — Weapons
['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,
},
FieldMeaning
labelDisplay name
weightGrams
durabilityWear per shot (smaller = lasts longer)
ammonameAmmo item the weapon loads
throwableThrown weapons (grenades, balls)
animCustom draw/holster animation

#The Components table

data/weapons.lua — Components
['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

data/weapons.lua — Ammo
['ammo-9'] = {
    label = '9mm',
    weight = 7,
},

Which weapon uses which ammo item is listed in 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.

#Common mistakes

SymptomCause
Weapon cannot be reloadedammoname missing or not an Ammo item
Attachment does nothingComponent hash not in the item’s client.component list
No image in inventoryImage file name does not match the item name
Weapon breaks too fastdurability too high for its fire rate
Share this guideXRedditFacebook

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.

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.