HEX
HexscriptsJobscreatorExportsClient Exports

Player & Interaction Info

Client exports to read the local player's job, duty state and closest interaction point.

getJobData

The local player's job.

local job = exports['hex_jobscreator']:getJobData()

Prop

Type

Returns

ValueMeaning
tablethe job, shape below
nil, 'no_job'the player has no job in that slot
{
    name = 'police',
    label = 'Police',
    grade = 3,
    gradeName = 'sergeant',
    gradeLabel = 'Sergeant',
    salary = 250,
    onDuty = true,
    is2Job = false
}

isOnDuty

Whether the local player is clocked in.

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

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, reasonsee the reasons below

Reasons

CodeMeaning
no_jobthe player has no job in that slot
off_dutyclocked out

getClosestInteraction

The nearest interaction of a type that the local player has access to.

Range is not checked

Read distance from the result and decide for yourself whether the player is close enough.

local point = exports['hex_jobscreator']:getClosestInteraction('storage')

Prop

Type

Returns

ValueMeaning
tablethe point, shape below
nil, reasonsee the reasons below
{
    id = 42,
    type = 'storage',
    label = 'Armory',
    distance = 18.4,
    is2Job = false,
    public = false,
    coords = { x = 441.2, y = -981.5, z = 30.7 }
}

Reasons

CodeMeaning
invalid_typeinteraction type must be a non-empty string
none_configuredno interaction of that type the player can use