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
| Value | Meaning |
|---|---|
| table | the 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
| Value | Meaning |
|---|---|
true | on duty |
true, 'no_duty_point' | the job has no duty point, so the player counts as always on duty |
false, reason | see the reasons below |
Reasons
| Code | Meaning |
|---|---|
no_job | the player has no job in that slot |
off_duty | clocked 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
| Value | Meaning |
|---|---|
| table | the point, shape below |
nil, reason | see 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
| Code | Meaning |
|---|---|
invalid_type | interaction type must be a non-empty string |
none_configured | no interaction of that type the player can use |