Studios
Licensinghouse-3.jpg

Commands & Exports

SoonLicensingQbox
PAGE 06 OF 06  ·  TROUBLESHOOTING → COMMANDS & EXPORTSdocs.glitchstudios.dev
Browse docs

Commands#

The resource registers no commands. Players use the ox_target option on the clerk ped.

Server exports#

All exports are server side. Call them as exports['glitch-licensing']:Name(...).

Export Returns
Holds(src, key) true if the online player holds the licence.
Suspended(citizenid, key) Suspension text, or nil when the citizen is free to buy.
Sheet(citizenid) { rows, online }, or nil for an invalid citizen ID. Each row has key, label, held, pending ('grant', 'revoke' or nil) and suspended ({ text, perm, untilAt, reason } or nil).
Grant(officerCid, citizenid, key) ok, message. Fails if they already hold it. Lifts a suspension on that licence.
Revoke(officerCid, citizenid, key, ban, reason) ok, message. ban is a number of hours, 'perm' or nil. Any other value is ignored.
LiftBan(officerCid, citizenid, key) ok, message. Fails if the citizen is not suspended from that licence.
IsLicence(key) true if the key exists in Config.Licences.
PoliceRank() The value of Config.PoliceRank.

Grant, Revoke and LiftBan do not check the officer's rank. They notify the target player when online and log to glitch-admin with the officer's ID.

Client exports#

None.

Events and callbacks#

The resource registers three lib.callback handlers for its own menu: glitch-licensing:list, glitch-licensing:buy and glitch-licensing:replace. They reject requests from players who are not at the counter and are not meant to be called by other resources.

It listens to the server event QBCore:Server:PlayerLoaded to sync metadata and apply pending changes. When Config.LegendEvent is set, the client triggers <LegendEvent>:name with the blip handle and name, and answers <LegendEvent>:request by sending them again.

Database#

Table Columns
licence_bans citizenid, licence, until_at (NULL is permanent), reason, officer, created_at. Primary key is citizenid plus licence.
licence_pending citizenid, licence, action (grant or revoke), created_at. Primary key is citizenid plus licence.

Expired suspensions are deleted on start and ignored when read.