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
| Value | Meaning |
|---|---|
| table | the 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
| Value | Meaning |
|---|---|
| table | the licences the player holds |
table, 'no_licenses' | the list is empty |
nil, reason | invalid_player · player_not_found |
hasLicense
Whether a player holds a licence.
local has, err = exports['hex_jobscreator']:hasLicense(5, 'dmv')Prop
Type
Returns
| Value | Meaning |
|---|---|
true | player holds it |
false, reason | see the reasons below |
Reasons
| Code | Meaning |
|---|---|
invalid_player | player id must be a number |
player_not_found | no such player on the server |
invalid_license | licence type must be a non-empty string |
unknown_license | no licence type with that name |
not_owned | the 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
| Value | Meaning |
|---|---|
true | licence issued |
false, reason | see the reasons below |
Reasons
| Code | Meaning |
|---|---|
invalid_player | player id must be a number |
player_not_found | no such player on the server |
invalid_license | licence type must be a non-empty string |
unknown_license | no licence type with that name |
already_owned | the player already holds that licence |
give_failed | the licence resource rejected the write |
revokeLicense
Removes a licence from a player.
local ok, err = exports['hex_jobscreator']:revokeLicense(5, 'dmv')Prop
Type
Returns
| Value | Meaning |
|---|---|
true | licence removed |
false, reason | see the reasons below |
Reasons
| Code | Meaning |
|---|---|
invalid_player | player id must be a number |
player_not_found | no such player on the server |
invalid_license | licence type must be a non-empty string |
unknown_license | no licence type with that name |
not_owned | the player does not hold that licence |
revoke_failed | the licence resource rejected the delete |