HEX
HexscriptsJobscreatorExportsServer Exports

Player Jobs

Server exports to read and set a player's job, grade, duty state and action access.

Server exports have no source

Every player-scoped export takes the player's server id as its first argument.

getPlayerJob

A player's job the same table shape as the client's getJobData.

local job, err = exports['hex_jobscreator']:getPlayerJob(5)

Prop

Type

Returns

ValueMeaning
tablethe job
nil, reasoninvalid_player · player_not_found · no_job

setPlayerJob

Sets a player's job and saves it to the database.

local ok, err = exports['hex_jobscreator']:setPlayerJob(5, 'police', 3, true)

Prop

Type

Returns

ValueMeaning
truejob set and saved
false, reasonsee the reasons below

Reasons

CodeMeaning
invalid_playerplayer id must be a number
player_not_foundno such player on the server
invalid_jobjob name must be a non-empty string
reserved_jobpublic cannot be assigned to a player
unknown_jobno job with that name
unknown_gradethat job has no such grade
not_a_second_jobthat job is not marked as usable in the second slot

setPlayerDuty

Clocks a player in or out, keeping their job and grade, and saves it.

Note

Already being in the requested state counts as success.

local ok, err = exports['hex_jobscreator']:setPlayerDuty(5, false)

Prop

Type

Returns

ValueMeaning
trueduty state applied
false, reasoninvalid_player · player_not_found · invalid_duty · no_job

isPlayerOnDuty

Whether a player is clocked in.

local onDuty, err = exports['hex_jobscreator']:isPlayerOnDuty(5)

Prop

Type

Returns

ValueMeaning
trueon duty
true, 'no_duty_point'the job has no duty point, so the player counts as always on duty
false, reasoninvalid_player · player_not_found · no_job · off_duty

hasPlayerActionAccess

Whether a player's job grants an action menu action, checking both job slots.

Raw action names only

This takes raw action names only (handcuff_back, revive, give_license, …) no categories or aliases. Those belong to the client's hasPlayerAccess, which also lists every action name.

local ok, err = exports['hex_jobscreator']:hasPlayerActionAccess(5, 'handcuff_back')

Prop

Type

Returns

ValueMeaning
trueallowed
false, reasoninvalid_player · invalid_action · player_not_found · no_access