Run a counter with only self-contained licences#
Point the hunting, fishing and boat rows at meta if you do not run the Glitch Studios job resources:
{ key = 'hunting', label = 'Hunting Licence', store = 'meta', price = 500, icon = 'paw',
desc = 'Allowed to hunt.' },
Add a licence#
Add a row to Config.Licences. A new key works with every export straight away:
{ key = 'truck', label = 'Heavy Vehicle Licence', store = 'meta', price = 1800, card = 'truck_license', icon = 'truck',
desc = 'Required to drive heavy vehicles.' },
If you set a card, add that item to ox_inventory first.
Block a sale for a suspended player#
Suspended returns text such as Suspended for 2 more days, or nil when the citizen is free to buy:
local reason = exports['glitch-licensing']:Suspended(citizenid, 'weapon')
if reason then
return false, ('Weapon Licence: %s.'):format(reason)
end
Check that a player holds a licence#
if not exports['glitch-licensing']:Holds(source, 'driver') then
return false
end
Revoke and suspend from an MDT#
Pass hours, or 'perm', as the fourth argument to also suspend. Leave it out to revoke only:
-- revoke the weapon licence and block a new one for 48 hours
local ok, message = exports['glitch-licensing']:Revoke(officerCitizenId, targetCitizenId, 'weapon', 48, 'Reckless discharge')
-- revoke permanently
exports['glitch-licensing']:Revoke(officerCitizenId, targetCitizenId, 'weapon', 'perm', 'Armed robbery')
-- suspend someone who does not hold the licence
exports['glitch-licensing']:Revoke(officerCitizenId, targetCitizenId, 'driver', 24)
Grant, lift and list#
local ok, message = exports['glitch-licensing']:Grant(officerCitizenId, targetCitizenId, 'driver')
local ok2, message2 = exports['glitch-licensing']:LiftBan(officerCitizenId, targetCitizenId, 'driver')
local sheet = exports['glitch-licensing']:Sheet(targetCitizenId)
if sheet then
for _, row in ipairs(sheet.rows) do
print(row.key, row.held, row.pending, row.suspended and row.suspended.text)
end
end
Your MDT must check the officer's grade (see PoliceRank) before it calls Grant, Revoke or LiftBan.
Stuck on a step?Ask in the Discord →