Weapon serial numbers and registration in FiveM
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.
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
-- 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 and weapon licences.
#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
serialandregisteredfrom a weapon’s metadata for a price. - Armoury accountability:
POLserials make it obvious when a police weapon ends up in the wrong hands.
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?
serial prefix of up to three characters, such as POL.How do I give a weapon without a serial?
metadata = { registered = false }. ox_inventory then sets neither an owner nor a serial.Can I set my own full serial number?
serial longer than three characters is used exactly as given.Who is the registered owner of a weapon?
registered to set a specific name.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.