Skip to content

Jobs Contract

Contract: IJobs
Default provider: shiva-jobs

Manages jobs, grades, and duty state.

Methods

IJobs:getJob(serverId)

Get a player's current job and grade.

lua
local jobs = container:make('IJobs')
local job = jobs:getJob(source)
-- { name = 'police', label = 'LSPD', grade = 2, gradeLabel = 'Sergeant' }

Returns: JobData


IJobs:setJob(serverId, jobName, grade?)

Set a player's job.

lua
jobs:setJob(source, 'mechanic', 1)

IJobs:getAllJobs()

Get all configured jobs.

Returns: table{ [jobName] = JobConfig }


IJobs:isOnDuty(serverId)

Check if a player is clocked in.

Returns: boolean


IJobs:setDuty(serverId, onDuty)

Set duty state.

lua
jobs:setDuty(source, true)

Events Emitted

EventPayload
jobs:jobChanged{ playerId, oldJob, newJob, grade }
jobs:dutyChanged{ playerId, job, onDuty }

Released under the MIT License.