LGMods Licensing
LGMods Licensing
UK-style driving licence system for FiveM. Players apply at a front desk, receive a physical inventory item, and police can manage applications, points, bans, and revocations.
Resource folder name must be LGMods_Licensing
Exports are called as exports['LGMods_Licensing']:.... If you rename the resource folder, those calls (and inventory item export strings) will break unless you update them everywhere.
Features
Front desk offices (blips, optional NPCs, interact key) to apply for licences
Licence categories with auto-issue or police approval
Physical inventory item with metadata (where the inventory supports it)
Police management UI: applications, search, points, ban, revoke, add category
Penalty points with history and auto-expiry
DVLA-style licence number generation
ESX / QBCore frameworks
ox_inventory / qs-inventory / qb-inventory / ESX inventory
Requirements
Yes
ESX (es_extended) or QBCore (qb-core)
Yes (one of them)
Matching inventory for Config.InventorySystem
Yes
ox_lib
Optional (notifications / menus when enabled)
Installation
Place the resource in your server resources folder as
LGMods_Licensing.Ensure start order: framework → inventory → oxmysql → this resource.
Open
config.luaand set:Config.Framework-'auto','esx', or'qbcore'Config.InventorySystem- must match the inventory you actually use
Import
sql/install.sqlinto your database (or let the script auto-create tables on start).Register the item
drivers_licensein your inventory - see Inventory item setup. This is the most common cause of “exports / item not working”.Set front desk coords, police jobs, costs, and categories as needed.
Restart the resource and test with
/mylicenseand the front desk.
Tables are created automatically on start if missing. Running sql/install.sql manually is still recommended for clean installs.
Configuration overview
All settings live in config.lua.
Framework & inventory
Licence rules
Config.License.DefaultType-'full'or'provisional'Config.License.MaxPoints- default12(licence treated as suspended at this total)Config.License.PointExpiryDays- default84(12 weeks)Config.License.Categories- each category has anameandrequiresApproval
If requiresApproval = false, the licence / category is issued immediately at the front desk. If true, police must approve the application.
Front desk
MinAge- default17Cost- cash cost (default45)Locations- coords, heading, blipInteractionKey- default38(E)ShowBlips/SpawnNPCs
Police
Add every job name that should access /licenses and police commands.
UI & exports
Inventory item setup
The item spawn name is hardcoded as drivers_license
There is no config option to rename it. Your inventory item must be named exactly drivers_license (underscore, no spaces, no capital letters).
The script does not ship item definitions. You must add them to your inventory / framework yourself. If the item is missing, players can still get a DB licence but will not receive (or cannot use) the physical card.
Metadata the script writes
When a licence item is given, the script attaches:
license_number
Raw licence number
formatted_number
Spaced display form
name
Holder name
dob
Date of birth
type
full or provisional
categories
e.g. A,B
points
Current penalty points
is_valid
Validity flag
description
Short summary string
age
Calculated age (when available)
ox_inventory stores this on
item.metadataqs-inventory / qb-inventory store this on
item.infoESX has no rich metadata - viewing pulls live data from the database
ox_inventory
Set in config:
Add to ox_inventory/data/items.lua (or your items file):
Recommended: keep stack = false so each licence is unique and metadata does not merge incorrectly.
Optional: buttons (view / show)
If your ox_inventory version supports item buttons, you can add:
The resource also listens for ox item-use / right-click events for drivers_license, so using the item should open the licence UI once the item exists.
Server export alternative
If you prefer a server use export on the item:
Both viewLicense and useDriversLicense are provided for inventory wiring.
Add an image as ox_inventory/web/images/drivers_license.png (optional but recommended).
qb-inventory (QBCore)
Set in config:
Add to qb-core/shared/items.lua (or your items shared file):
unique = true and useable = true are important. Metadata is stored in info.
Place drivers_license.png in your inventory images folder (commonly qb-inventory/html/images/).
The script listens for qb-inventory:client:UseItem when the item name is drivers_license.
qs-inventory
Set in config:
Register the item in your qs-inventory items list / database with spawn name:
Example shared-style definition (adjust to your qs-inventory format):
The script listens for qs-inventory:client:UseItem. Metadata is stored in info.
If qs-inventory fails to add the item, the script may fall back to ESX addInventoryItem - the item must still exist in both places if you rely on that fallback.
ESX default inventory
Set in config:
Add the item to your items table (SQL example):
Or via your items management resource - spawn name must still be drivers_license.
ESX inventory does not store rich metadata on the item. Viewing the licence loads data from the LGMods database instead. Players can also use /mylicense.
If you use a usable-item system that fires esx:useItem, the script will open the licence UI for drivers_license.
Quick checklist (item not working)
Config
InventorySystemmatches the inventory that is actually running.Item name is exactly
drivers_license.Resource folder is exactly
LGMods_Licensing.Item is registered and the inventory was restarted after adding it.
Player has space / can carry the item (especially ox_inventory).
For ox:
client.export/server.exportpoints atLGMods_Licensing.viewLicenseorLGMods_Licensing.useDriversLicense.For QB/QS: item is
useable = true/unique = true.
How the system works
Getting a licence
Go to a configured front desk location and press E (or your interaction key).
Choose licence type and category.
Age and cash are checked (
MinAge,Cost).If the category does not require approval → licence is created and the
drivers_licenseitem is given.If it does require approval → an application is created and police are notified. On approval, the licence/category is granted and the item is given/updated.
Using the item
Use the item in inventory to open the licence UI.
Show to nearby players (within ~5m where supported).
Police can verify against the database.
Validity
A licence is treated as invalid if:
It is revoked
It is banned (
banned_untilstill in the future)Points are at or above
Config.License.MaxPoints(default 12)
Points expire after PointExpiryDays and are cleaned up automatically.
Commands
Everyone
/mylicense
View your own licence status
/licensehelp
Show available commands
Police (jobs in Config.Police.RequiredJobs)
/licenses
Open police licence management UI
/addpoints
/addpoints [id] [1-12] [reason]
/removepoints
/removepoints [id] [points]
/banlicense
/banlicense [id] [days] [reason]
/unbanlicense
/unbanlicense [id]
/revokelicense
/revokelicense [id] [reason]
/reinstatelicense
/reinstatelicense [id]
/grantlicense
/grantlicense [id] [full|provisional] [category]
[id] is the player’s server ID.
Exports (for other scripts)
For other resources, use the player ID (server source) exports below. Always call them with the resource name:
exports['LGMods_Licensing']:ExportName(...)
Recommended public API (server)
These are the exports you should use from other scripts.
GrantLicense
Creates a licence in the database and gives the inventory item.
playerId(number) - requiredlicenseType(string) -'full'or'provisional'(default'full')category(string) - e.g.'B'(default'B')
Fails if the player already has a licence.
RevokePlayerLicense
BanPlayerLicense
UnbanPlayerLicense
ReinstatePlayerLicense
AddPoints / RemovePoints
HasValidLicense
HasLicense
GetPlayerLicenseStatus
GetLicenseByNumber
GetPlayerPointsHistory
Inventory / item-use exports (server)
Used when wiring inventory items - not usually needed for gameplay scripts.
Inventory helpers (server)
Useful if you need to give/remove/update the physical item yourself:
GiveLicenseItem(playerId, licenseData)
Give the item with metadata
RemoveLicenseItem(playerId, licenseNumber)
Remove matching item
UpdateLicenseItemMetadata(playerId, licenseData)
Refresh item metadata
HasLicenseItem(playerId, licenseNumber)
Check if player has the card
RemoveAllLicenseItems(playerId)
Remove all licence items
GetLicenseMetadata(licenseData)
Build metadata table
Example:
Client exports (UI / item)
For ox_inventory item definitions, the usual string is:
Example integrations
Block driving without a valid licence
Add points from another script
Grant a licence from an admin menu
Database
Default tables (names configurable in Config.Database):
lgmods_licenses- main licence records (one per citizen)lgmods_license_points- points historylgmods_license_applications- pending / processed applications
SQL file: sql/install.sql.
Troubleshooting
“Exports don’t work”
Resource name is
LGMods_Licensing(exact).Resource is started before the script that calls the export.
You are calling server exports from the server, and client exports from the client.
Config.Exports.EnableAllistrue.Use
exports['LGMods_Licensing']:HasValidLicense(source)- not a made-up export name.
“Player got approved but no item”
Item
drivers_licenseis not registered in the inventory.Wrong
Config.InventorySystem.Inventory inventory is full / cannot carry.
Inventory resource was not restarted after adding the item.
On ESX, confirm the row exists in the
itemstable.
“Using the item does nothing”
ox: missing
client.export/server.export, or export string typo.QB/QS: item not marked useable.
Item name is not exactly
drivers_license.Metadata missing (old/admin-given item without metadata) - try
/mylicenseor re-grant via/grantlicense/ police tools.
“Police commands say no permission”
Add the player’s exact job name to Config.Police.RequiredJobs (e.g. 'police', 'sheriff').
Categories missing in the menu
Any category you add under Config.License.Categories should appear after a resource restart. Make sure the key and name / requiresApproval fields are valid Lua.
Support notes
Keep
config.luaedits only - that file is listed for escrow ignore.Do not rename the item away from
drivers_licenseunless you are prepared to edit the script itself.Prefer the player-ID exports (
GrantLicense,BanPlayerLicense,AddPoints, etc.) for third-party integrations.
Last updated