Scriptingintermediate10 min readupdated 11 Sept 2026

Weapon licences in FiveM

The short answer

In ox_inventory, add license = 'weapon' to a shop item and only players with that licence can buy it. ox_inventory checks licences through its framework bridge: on ESX it reads the user_licenses table, on Qbox it reads metadata.licences, and on ox_core and ND_Core it asks the framework. Its default data includes a weapon licence purchase point. QBCore stores licences in the player’s metadata (licences.weapon).

A weapon licence is a simple gate that creates a lot of roleplay: legal gun stores that ask for paperwork, police who check it during a stop, and a reason for criminals to use the black market. ox_inventory supports licence requirements on shop items out of the box; the licence itself lives in your framework.

Weapon licences in FiveM — illustrated with a FiveM-compatible minimap render

#Licence-gated shop items in ox_inventory

ox_inventory/data/shops.lua
Ammunation = {
    name = 'Ammunation',
    blip = { id = 110, colour = 69, scale = 0.8 },
    inventory = {
        { name = 'ammo-9', price = 5 },
        { name = 'WEAPON_KNIFE', price = 200 },
        { name = 'WEAPON_PISTOL', price = 1000, metadata = { registered = true }, license = 'weapon' },
    },
    locations = { vec3(-662.180, -934.961, 21.829) },
},

Only items with license are gated; ammo and melee weapons in the same shop can be bought by anyone. Registered weapons also get a serial — see serial numbers.

#Buying the licence

ox_inventory’s default data/licenses.lua defines a weapon licence for sale at a location near the Ammu-Nation on Adam’s Apple Boulevard, for $5,000. When a player buys it, ox_inventory takes the money and grants the licence through the framework bridge (on ESX by triggering esx_license:addLicense).

ox_inventory/data/licenses.lua (default)
return {
    { name = 'weapon', coords = vec3(12.42198, -1105.82, 29.7854), price = 5000 },
}

#Where licences are stored

FrameworkStorageCheck from a script
ESXuser_licenses table (esx_license)TriggerEvent('esx_license:checkLicense', src, 'weapon', cb) or a query on user_licenses
QBCorePlayerData.metadata.licencesPlayer.PlayerData.metadata.licences.weapon
ox_coreFramework licence functionsplayer.getLicense('weapon')
ND_CorePlayer metadata licensesThe framework’s licence helpers

#Police checks and revoking

server.lua — QBCore example: revoke a weapon licence
local QBCore = exports['qb-core']:GetCoreObject()

local function setWeaponLicence(targetId, allowed)
    local Player = QBCore.Functions.GetPlayer(targetId)
    if not Player then return end
    local licences = Player.PlayerData.metadata.licences or {}
    licences.weapon = allowed
    Player.Functions.SetMetaData('licences', licences)
end

Put these actions behind a job check on the server — only police (and perhaps judges) should be able to grant or revoke. Anything exposed as a net event must verify the caller, as explained on pityus.net in client vs server scripts.

Share this guideXRedditFacebook

Questions

How do I require a weapon licence in ox_inventory shops?
Add license = 'weapon' to the shop item in data/shops.lua.
Where are weapon licences stored on ESX?
In the user_licenses table used by esx_license, with the licence type weapon.
How do I check a QBCore player’s weapon licence?
Read Player.PlayerData.metadata.licences.weapon on the server.
Can players buy a weapon licence by default?
ox_inventory’s default data includes a weapon licence purchase point for $5,000. Many servers replace it with a police-issued licence.

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.