Documentation › Hunting System › Integrations › License Providers
Store hunting licenses in the database, an item, esx_license, QB metadata or your own system.
Pick where licenses are stored. The rest of the script (shop, selling, poaching, /huntlicense, exports) works the same with every provider.
Config.LicenseProvider = {
provider = 'internal', -- internal | item | esx_license | qb_metadata | custom
type = 'hunting', -- license type for esx_license / qb_metadata
}| Provider | Stored in | Expiry |
|---|---|---|
internal |
smilescripts_hunting_licenses table |
Yes (Config.License.durationDays) |
item |
hunting_license inventory item |
No |
esx_license |
esx_license (user_licenses) |
No |
qb_metadata |
PlayerData.metadata.licences[type] |
No |
custom |
Your functions in bridge/server/license.lua |
Up to you |
With esx_license installed, set:
Config.LicenseProvider = { provider = 'esx_license', type = 'hunting' }Add the license type to your licenses table so it shows up in your MDT and ID card scripts:
INSERT INTO `licenses` (`type`, `label`) VALUES ('hunting', 'Hunting License');QBCore keeps licenses in player metadata (licences.driver, licences.weapon, ...). Store the hunting license there too:
Config.LicenseProvider = { provider = 'qb_metadata', type = 'hunting' }Police MDTs that read metadata.licences show it automatically. To give new characters the field from the start, add hunting = false to the default licences metadata in qb-core/server/player.lua.
QBox uses the same metadata structure as QBCore:
Config.LicenseProvider = { provider = 'qb_metadata', type = 'hunting' }Set provider = 'custom' and fill in the three functions in bridge/server/license.lua:
providers.custom = {
Get = function(src)
return exports['my-mdt']:HasLicense(src, 'hunting'), 0 -- valid, expiresAt (0 = permanent)
end,
Give = function(src, days)
exports['my-mdt']:AddLicense(src, 'hunting')
return 0 -- expiresAt, or nil on failure
end,
Revoke = function(src)
exports['my-mdt']:RemoveLicense(src, 'hunting')
return true
end,
}Only the internal provider can expire. With the others, buying a license when you already have one is refused.