Inventoryintermediate10 min readupdated 11 Sept 2026

Weapon durability in FiveM

The short answer

In ox_inventory a weapon item starts with metadata.durability = 100, and each shot lowers it by the weapon’s durability value from data/weapons.lua (for example 0.1 for pistols, 0.03 for rifles). At 0 the weapon is broken and cannot be used until repaired. Tune the per-weapon value for how many shots a gun should last, and add repair through a script that sets the durability back.

Durability turns weapons from permanent trophies into equipment that wears out — which gives gunsmiths a job, makes cheap guns feel cheap and slows the flood of weapons on a roleplay economy. ox_inventory has durability built in; the numbers just need to fit your server.

Weapon durability in FiveM — illustrated with a FiveM-compatible minimap render

#How ox_inventory durability works

When ox_inventory creates a weapon item it sets metadata.durability to 100 if the weapon defines a durability value. As the weapon is fired, durability falls by that value per shot. The weapon item displays its condition in the inventory, and at zero the inventory will not let the player use it.

ox_inventory/data/weapons.lua (default values)
['WEAPON_PISTOL'] = {
    label = 'Pistol',
    weight = 1130,
    durability = 0.1,
    ammoname = 'ammo-9',
},
['WEAPON_ASSAULTRIFLE'] = {
    label = 'Assault Rifle',
    weight = 4500,
    durability = 0.03,
    ammoname = 'ammo-rifle2',
},

#Tuning: how many shots should a gun last?

durability valueShots from 100 to 0Feel
0.3≈ 330Cheap, breaks quickly — street guns
0.1≈ 1,000Default pistols
0.05≈ 2,000Well-kept sidearm
0.03≈ 3,300Default rifles
0.01≈ 10,000Almost never breaks — police issue

Think in magazines: at 0.1 a 12-round pistol lasts about 80 magazines. On a serious roleplay server where shootouts are rare, that is effectively forever; on a gang-heavy server it is a few busy evenings. Adjust per weapon rather than globally, so a rare rifle does not wear as fast as a street pistol.

#Repair kits and gunsmiths

Repair means setting metadata.durability back up on the server. A repair-kit item can do it for the weapon in the player’s hands:

server.lua (ox_inventory)
RegisterNetEvent('gunsmith:repairCurrent', function(slot)
    local src = source
    local weapon = exports.ox_inventory:GetSlot(src, slot)
    if not weapon or not weapon.name:find('^WEAPON_') then return end

    -- consume one repair kit first
    if not exports.ox_inventory:RemoveItem(src, 'weapon_repairkit', 1) then return end

    weapon.metadata.durability = 100
    exports.ox_inventory:SetMetadata(src, slot, weapon.metadata)
end)
  • Validate on the server: the slot must hold a weapon and the kit must actually be removed.
  • Consider partial repairs (+40) so kits are a resource, not a reset button.
  • A gunsmith job that repairs for money creates a real roleplay role.

Metadata editing in general is covered in ox_inventory metadata.

#Durability on QBCore

qb-weapons tracks weapon quality in the item’s info and lowers it as the weapon is used, with a repair location configured in its config. The idea is the same; the field names and config differ, so check your qb-weapons version.

Share this guideXRedditFacebook

Questions

How does weapon durability work in ox_inventory?
Weapons start at metadata.durability = 100 and lose the weapon’s durability value from data/weapons.lua with each shot. At 0 they are broken.
How do I make weapons last longer?
Lower the durability value for that weapon in data/weapons.lua, for example from 0.1 to 0.05.
How do I repair a weapon in ox_inventory?
On the server, set the item’s metadata.durability back to a higher value with exports.ox_inventory:SetMetadata, usually after removing a repair-kit item.
Can I turn durability off?
Remove the durability field from the weapon in data/weapons.lua; new items of that weapon will not degrade.

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.