HEX
HexscriptsJobscreatorExportsServer Exports

Licenses

Server exports to read, give and revoke licences through the licence bridge.

Licence bridge

These run through the licence bridge, so they work with whatever Config.Licenses.api points at.

⏳ Needs a thread

Every export on this page must be called from a thread see Calling from a thread.

getLicenses

Every licence type that exists.

local licenses, err = exports['hex_jobscreator']:getLicenses()

Returns

ValueMeaning
tablethe licence types, shape below
table, 'no_licenses'the list is empty
{ { type = 'dmv', label = 'Driving Permit' }, ... }

getPlayerLicenses

The licences a player holds, same shape as getLicenses.

local licenses, err = exports['hex_jobscreator']:getPlayerLicenses(5)

Prop

Type

Returns

ValueMeaning
tablethe licences the player holds
table, 'no_licenses'the list is empty
nil, reasoninvalid_player · player_not_found

hasLicense

Whether a player holds a licence.

local has, err = exports['hex_jobscreator']:hasLicense(5, 'dmv')

Prop

Type

Returns

ValueMeaning
trueplayer holds it
false, reasonsee the reasons below

Reasons

CodeMeaning
invalid_playerplayer id must be a number
player_not_foundno such player on the server
invalid_licenselicence type must be a non-empty string
unknown_licenseno licence type with that name
not_ownedthe player does not hold that licence

giveLicense

Issues a licence to a player.

local ok, err = exports['hex_jobscreator']:giveLicense(5, 'dmv')

Prop

Type

Returns

ValueMeaning
truelicence issued
false, reasonsee the reasons below

Reasons

CodeMeaning
invalid_playerplayer id must be a number
player_not_foundno such player on the server
invalid_licenselicence type must be a non-empty string
unknown_licenseno licence type with that name
already_ownedthe player already holds that licence
give_failedthe licence resource rejected the write

revokeLicense

Removes a licence from a player.

local ok, err = exports['hex_jobscreator']:revokeLicense(5, 'dmv')

Prop

Type

Returns

ValueMeaning
truelicence removed
false, reasonsee the reasons below

Reasons

CodeMeaning
invalid_playerplayer id must be a number
player_not_foundno such player on the server
invalid_licenselicence type must be a non-empty string
unknown_licenseno licence type with that name
not_ownedthe player does not hold that licence
revoke_failedthe licence resource rejected the delete