3 min read
QBCore Weapon License
The current QBCore weapon-license flow spans multiple resources:
qb-policejobgrants or revokes the permission state.qb-corestores that state inPlayerData.metadata.licences.weapon.qb-cityhalllets an eligible player buy the hard-copy license item.qb-shopscan require theweaponlicense before selling configured products.
The metadata permission and the physical license item are different things.
Default metadata state
Current qb-core initializes license metadata like this:
licences = {
driver = true,
business = false,
weapon = false
}So a new character does not have weapon-license permission by default.
Read it server-side from:
local Player = exports['qb-core']:GetPlayer(source)
if not Player then return end
local hasWeaponLicense = Player.PlayerData.metadata.licences.weapon == trueDo not trust a client-provided Boolean for purchase authorization.
Grant a weapon license
Current qb-policejob documents:
/grantlicense [id] [license]For a weapon license:
/grantlicense 12 weaponThe command is available to police who meet Config.LicenseRank. The official resource defaults
that threshold to grade 2.
Revoke a weapon license
Current command documentation uses:
/revokelicense [id] [license]Example:
/revokelicense 12 weaponLegacy docs use a different command
Older QBCore prose still contains /revoke [id] [licenseType]. The current command reference and
qb-policejob documentation use /revokelicense. Verify the command registered by the exact
qb-policejob commit you deploy.
Revoking metadata permission does not automatically remove a previously issued hard-copy item from the player's inventory. Decide explicitly whether your server wants that separate behavior.
Buy the hard-copy license at City Hall
Current qb-cityhall filters available license documents against the player's
metadata.licences table. Its server handler includes a weaponlicense document type and creates
the item only after the configured City Hall checks and payment path succeed.
That means the usual flow is:
Police grants metadata permission
↓
metadata.licences.weapon = true
↓
City Hall exposes the weapon-license document
↓
Player purchases the hard-copy itemSee qb-cityhall for resource-specific configuration.
Require the license in qb-shops
The current qb-shops/config.lua uses the string field requiredLicense:
{ name = 'weapon_pistol', price = 2500, amount = 5, requiredLicense = 'weapon' }The current default weapons product list applies the same requirement to licensed ammunition and several pistols.
Do not copy the old Boolean key
Older documentation examples use requiresLicense = true. Current qb-shops uses
requiredLicense = 'weapon'. Pin your configuration to the version you actually deploy.
Grant weapon permission to every new character
If your game design intentionally gives every new character permission, change the default in the core configuration/source used by your deployed revision so that:
weapon = trueDo this only if it matches your server rules. Existing characters already stored in the database may retain their existing metadata and therefore require a migration rather than merely changing a default.
Custom license types
The license table is extensible, but all participating resources must agree on the same string.
For example, if you introduce hunting:
PlayerData.metadata.licences.hunting = truethen police/admin issuance, City Hall documents, shops and any custom resource must all use exactly that key. Avoid inventing multiple spellings for the same permission.
Troubleshooting
| Symptom | Check |
|---|---|
/grantlicense is missing | Confirm qb-policejob is installed, started and matches the documented revision. |
| Officer cannot grant it | Check police job, duty/grade logic and Config.LicenseRank. |
| City Hall does not show the document | Inspect metadata.licences.weapon and the City Hall license config. |
| Player has the card but shop refuses purchase | A physical item is not the same as the metadata permission; inspect the current metadata and shop config. |
| Shop sells guns without a license | Add requiredLicense = 'weapon' to the products that should be restricted. |
| Old config stopped working after update | Compare requiresLicense = true with the current requiredLicense = 'weapon' schema. |
Related documentation
Sources
- Current qb-core player defaults
- Current qb-policejob documentation
- Current QBCore command reference
- Current qb-cityhall server implementation
- Current qb-shops config
- Legacy miscellaneous weapon-license guide
Verified 2026-09-27.
Found an issue in this guide?
Send the page URL, the affected example, and a source or reproduction to the site maintainer. For a server or resource problem, use the support guide.
Admin Commands
Find QBCore admin commands for staff permissions, jobs, vehicles and money, including qb-adminmenu setup and checks for missing or restricted commands.
NUI Form with Callback
Download a complete QBCore NUI resource with HTML, CSS, JavaScript, Lua callbacks, server validation, timeouts and focus cleanup.
