Adding a weapon to QBCore
Add a custom weapon to QBCore: the exact qb-core/shared/weapons.lua entry, the backtick gotcha, and where the inventory image goes. Copy-paste ready.
QBCore keeps its weapon list in qb-core/shared/weapons.lua, keyed by weapon hash. The syntax is unusual — the key is wrapped in backticks, not quotes — and getting that wrong is the most common reason an otherwise correct entry does nothing.

#The entry
Open qb-core/shared/weapons.lua and add your weapon inside the existing Weapons table. The key is the lowercase weapon name in backticks, which Lua evaluates as the weapon's hash.
QBShared.Weapons = {
[`weapon_mygun`] = {
['name'] = 'weapon_mygun',
['label'] = 'My Gun',
['weapontype'] = 'Pistols',
['ammotype'] = 'AMMO_PISTOL',
['damagereason'] = 'Killed',
},
-- ... the weapons that were already here
}#Choosing weapontype and ammotype
weapontype groups the weapon in menus and decides which animations and stats QBCore applies. ammotype has to match the weapon's AmmoInfo from weapons.meta or reloading breaks. Use these pairings:
- Pistols — AMMO_PISTOL
- Sub Machine Guns — AMMO_SMG
- Rifles — AMMO_RIFLE
- Light Machine Guns — AMMO_MG
- Shotguns — AMMO_SHOTGUN
- Sniper Rifles — AMMO_SNIPER
- Heavy Weapons — AMMO_RPG or AMMO_GRENADELAUNCHER
- Melee Weapons — no ammotype at all
- Thrown Weapons — the weapon's own name as the ammo type
#The inventory image
- Export a transparent PNG named after the item in lowercase: weapon_mygun.png.
- Copy it into qb-inventory/html/images/. Some forks use a different path — check where the existing weapon images live and match that.
- Restart qb-inventory and rejoin, so the NUI reloads its image list.
#If you run ox_inventory on QBCore
Some QBCore-based servers run ox_inventory instead of qb-inventory — officially through Qbox, which keeps QBCore compatibility, or through a community fork. If yours does, skip this guide entirely and register the weapon in ox_inventory/data/weapons.lua instead. Adding it to both produces two competing definitions, and which one wins depends on load order — which is exactly the kind of bug that only appears on a full restart at the worst moment.
Questions
My weapon is in shared/weapons.lua but /giveitem says invalid.
Do I need to add ammo as a separate item?
Where does damagereason show up?
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.