# Weapon serial numbers and registration in FiveM

> How ox_inventory generates weapon serials and the registered owner: the serial format, job prefixes, unregistered guns and reading serials in a police MDT.

Source: https://fam-tools.com/guides/fivem-weapon-serial-numbers · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 10 min

**Short answer.** When ox_inventory creates a weapon that uses ammo, and `metadata.registered` is not `false`, it sets `registered` to the player’s name (or the string you pass) and generates a serial. The serial is six random digits, three letters, six random digits — or your own text in the middle if you pass a prefix of up to three characters, like `serial = 'POL'`. Setting `registered = false` creates an unregistered weapon with no serial.

## Key points

- Serial format: `123456ABC654321` — the middle is random letters or your 3-character prefix.
- A `serial` longer than three characters is used as-is.
- `registered = true` fills in the buyer’s name; a string sets a specific name.
- `registered = false` → no owner and no serial (black-market guns).
- Throwables do not keep serials.

Serial numbers are what turn a gun into evidence. On a roleplay server the police can run a recovered weapon’s serial, find who bought it legally, and start an investigation — while black-market guns have no registered owner at all. ox_inventory handles serials and registration automatically, and knowing the exact rules lets you build shops, MDTs and crime around them.

## The exact rules

ox_inventory builds weapon metadata when an item is created by `AddItem`, a shop purchase or crafting. For weapons with ammo (and the stun gun), unless `metadata.registered` is `false`, it sets the owner and a serial:

| You pass | registered becomes | serial becomes |
| --- | --- | --- |
| nothing | the player’s name | 6 digits + 3 random letters + 6 digits |
| `registered = true` | the player’s name | as above |
| `registered = 'LSPD Armory'` | `LSPD Armory` | as above |
| `serial = 'POL'` | the player’s name | 6 digits + `POL` + 6 digits |
| `serial = 'ABCD1234'` (more than 3 chars) | the player’s name | `ABCD1234` exactly |
| `registered = false` | not set | not set — an untraceable weapon |

These rules come straight from ox_inventory’s item metadata code, and they are why its default police armoury passes `serial = 'POL'`: police-issued guns become recognisable at a glance.

## Legal and black-market shops

*ox_inventory/data/shops.lua (from the defaults)*

```lua
-- Legal gun store: registered to the buyer, needs a licence
{ name = 'WEAPON_PISTOL', price = 1000, metadata = { registered = true }, license = 'weapon' },

-- Police armoury: registered, recognisable serial
{ name = 'WEAPON_PISTOL', price = 500, metadata = { registered = true, serial = 'POL' }, license = 'weapon' },

-- Black market: no owner, no serial, paid in dirty money
{ name = 'WEAPON_CERAMICPISTOL', price = 50000, metadata = { registered = false }, currency = 'black_money' },
```

Shop setup in full, including licences, job grades and currencies, is in [ox_inventory shops](https://fam-tools.com/guides/ox-inventory-shops-config) and [weapon licences](https://fam-tools.com/guides/fivem-weapon-license-system).

## Using serials in roleplay

- **Evidence**: when police seize a weapon, they read its serial and registered owner from the item.
- **MDT lookups**: an MDT can store purchases (serial, owner, date) when a legal shop sells a gun, so a serial search returns history.
- **Scratched serials**: a criminal item or bench can remove `serial` and `registered` from a weapon’s metadata for a price.
- **Armoury accountability**: `POL` serials make it obvious when a police weapon ends up in the wrong hands.

*server.lua — scratching a serial (ox_inventory)*

```lua
local weapon = exports.ox_inventory:GetSlot(src, slot)
if weapon and weapon.metadata.serial then
    weapon.metadata.serial = nil
    weapon.metadata.registered = nil
    exports.ox_inventory:SetMetadata(src, slot, weapon.metadata)
end
```

## QBCore serials

QBCore weapons carry a serial in the item’s info, traditionally under the key `serie`, generated when the weapon is bought from a shop. Scripts that read serials on QBCore should read that field; check your qb-inventory version for the exact key.

## Questions

### How are ox_inventory serial numbers generated?

Six random digits, three characters, six random digits. The middle three are random letters unless you pass a `serial` prefix of up to three characters, such as `POL`.

### How do I give a weapon without a serial?

Pass `metadata = { registered = false }`. ox_inventory then sets neither an owner nor a serial.

### Can I set my own full serial number?

Yes. A `serial` longer than three characters is used exactly as given.

### Who is the registered owner of a weapon?

By default the name of the player who received it; pass a string in `registered` to set a specific name.

## Related

- https://fam-tools.com/guides/ox-inventory-metadata
- https://fam-tools.com/guides/ox-inventory-shops-config
- https://fam-tools.com/guides/fivem-weapon-license-system
- https://fam-tools.com/guides/fivem-police-armory-setup
