The QBCore weapons table
QBCore.Shared.Weapons is keyed by the weapon hash (written with backticks, e.g. [`weapon_pistol`]) and holds name, label, weapontype (Pistol, Rifle, Melee…), ammotype and damagereason text. Scripts use it to turn a hash from a native into a name, type or kill-log text. For an add-on weapon, add an entry here and a matching weapon item in shared/items.lua.
QBCore describes weapons in two places: as items in shared/items.lua (so they fit in the inventory) and as weapons in shared/weapons.lua (so scripts know what a hash is). Add-on weapons need both, and the weapons table is the one people forget.

#The format
QBCore.Shared.Weapons = {
[`weapon_pistol`] = { name = 'weapon_pistol', label = 'Walther P99', weapontype = 'Pistol', ammotype = 'AMMO_PISTOL', damagereason = 'Pistoled / Blasted / Plugged / Bust a cap in' },
[`weapon_bat`] = { name = 'weapon_bat', label = 'Bat', weapontype = 'Melee', ammotype = nil, damagereason = 'Melee killed / Whacked / Executed / Beat down / Murdered / Battered' },
}#What uses it
local QBCore = exports['qb-core']:GetCoreObject()
local hash = GetSelectedPedWeapon(PlayerPedId())
local info = QBCore.Shared.Weapons[hash]
if info then print(info.label, info.weapontype) endDeath screens and kill logs turn the killer’s weapon hash into text through this table. A missing entry shows as unknown or breaks those scripts. Hashes explained: weapon hashes.
#Adding an add-on weapon
- Add
[`weapon_mypistol`] = { name = 'weapon_mypistol', label = 'My Pistol', weapontype = 'Pistol', ammotype = 'AMMO_PISTOL', damagereason = 'Shot' }. - Add the item
weapon_mypistolwithtype = 'weapon'toshared/items.lua— see QBCore shared items. - Add the image and restart the server.
Full walkthrough: QBCore weapon setup.
Questions
What is qb-core shared/weapons.lua for?
Do I need to edit weapons.lua for an add-on weapon?
Why are the keys in backticks?
What is damagereason used for?
Ready to pick a map?
Twelve themes on three base map styles, $8 each, instant download.
Relevant to what you just read