# The QBCore weapons table

> What qb-core/shared/weapons.lua does: backtick hash keys, name, label, weapontype, ammotype and damagereason, and how to add add-on weapons to it.

Source: https://fam-tools.com/guides/qbcore-shared-weapons · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 7 min

**Short answer.** `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`.

## Key points

- Keyed by hash: `` [`weapon_x`] ``.
- Fields: `name`, `label`, `weapontype`, `ammotype`, `damagereason`.
- Add-ons need both a weapons entry and an item.
- Death and kill logs read `damagereason`.

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

*qb-core/shared/weapons.lua*

```lua
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

*client.lua — name of the weapon in hand*

```lua
local QBCore = exports['qb-core']:GetCoreObject()
local hash = GetSelectedPedWeapon(PlayerPedId())
local info = QBCore.Shared.Weapons[hash]
if info then print(info.label, info.weapontype) end
```

Death 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](https://fam-tools.com/guides/fivem-joaat-weapon-hashes).

## Adding an add-on weapon

1. Add `` [`weapon_mypistol`] = { name = 'weapon_mypistol', label = 'My Pistol', weapontype = 'Pistol', ammotype = 'AMMO_PISTOL', damagereason = 'Shot' } ``.
2. Add the item `weapon_mypistol` with `type = 'weapon'` to `shared/items.lua` — see [QBCore shared items](https://fam-tools.com/guides/qbcore-shared-items).
3. Add the image and restart the server.

Full walkthrough: [QBCore weapon setup](https://fam-tools.com/guides/qbcore-weapon-setup).

## Questions

### What is qb-core shared/weapons.lua for?

It maps weapon hashes to names, labels, types, ammo types and death-message text for scripts.

### Do I need to edit weapons.lua for an add-on weapon?

Yes, in addition to adding the weapon item to items.lua.

### Why are the keys in backticks?

Backticks produce the weapon hash at compile time, so scripts can look weapons up by the hash natives return.

### What is damagereason used for?

Text for death and kill messages.

## Related

- https://fam-tools.com/guides/qbcore-shared-items
- https://fam-tools.com/guides/qbcore-weapon-setup
- https://fam-tools.com/guides/fivem-joaat-weapon-hashes
- https://fam-tools.com/guides/fivem-inventory-systems-compared
