Browse docs
Events
Use events when your script needs to react to a change. Use an export when your script needs to read something or perform an action.
The names on this page are case-sensitive. The sky_jobs: prefix on job/duty events is intentional. It is different from the sky_jobs_base: prefix used by the other events.
Server events
Listen in server.lua using AddEventHandler. These are notifications emitted by Jobs Base. Do not trigger them to change a player's job, duty or money; call the corresponding server export.
Job changed
AddEventHandler("sky_jobs:jobChanged", function(playerId, newJob, oldJob, entry)
print(("Player %d changed job from %s to %s"):format(playerId, oldJob, newJob))
end)
| Argument | Type | Meaning |
|---|---|---|
playerId | number | Online player's server ID |
newJob | string | New technical job name |
oldJob | string | Previous technical job name |
entry | table | Current PlayerCache entry; treat it as read-only |
Emitted when an existing cached job name changes. A grade-only update or a player's first load is not a job-name change. Read current grade and duty with getPlayerJobInfo(playerId) when needed.
Duty changed
AddEventHandler("sky_jobs:dutyChanged", function(playerId, onDuty, entry, previousJob)
local info = exports["sky_jobs_base"]:getPlayerJobInfo(playerId)
if info and info.job == "sunrise_cafe" then
print(("Cafe employee %d is %s"):format(playerId, onDuty and "on duty" or "off duty"))
end
end)
| Argument | Type | Meaning |
|---|---|---|
playerId | number | Online player's server ID |
onDuty | boolean | New duty state |
entry | table | Current read-only PlayerCache entry |
previousJob | string? | Previous job name when supplied by the transition |
The event also occurs during initialisation of an on-duty player, so it is not a once-only reward or payment hook. It describes the current active job. Use setPlayerDuty to change duty.
Employees
| Event | Arguments | When it is emitted |
|---|---|---|
sky_jobs_base:management:memberAdded | playerId, identifier, jobName | The online hiring/enrolment path adds a job member. |
sky_jobs_base:management:memberRemoved | identifier, jobName | A job employee is removed through management. |
sky_jobs_base:multijob:memberRemoved | jobName, identifier, playerId? | A saved membership is removed; the player can be offline. |
These events describe the indicated workflow; memberAdded is not a universal promotion or offline-membership event. Use getJobMembers when you need the current complete roster. identifier is a persistent character ID; keep it in server-side integrations.
Invoice changed
AddEventHandler("sky_jobs_base:billing:changed", function(invoice)
if invoice.status == "paid" then
-- Refresh your invoice display or reconcile your saved payment record.
-- Use invoice.id as the key; a notification is not a second payment.
end
end)
The argument is the invoice's public data, including id, status, amount, amountPaid and balanceDue. Creation, partial payment, payment, cancellation and other updates can all notify listeners. This is not an instruction to pay the invoice again. See Billing.
Client events
Listen in client.lua. These events update the current player's display; make money and permission decisions on the server.
| Event | Arguments | Use |
|---|---|---|
sky_jobs_base:gradeChanged | oldGrade, newGrade | Management changed the online player's grade; each argument contains level and label. |
sky_jobs_base:billing:changed | None | Relevant invoices changed; refresh your authorised billing view. The server event with the same name has an invoice argument. |
sky_jobs_base:business:stateChanged | None | The synchronised Business state was applied; refresh your display. |
sky_jobs_base:business:historyChanged | jobName | That job's announcement history changed. |
For example, receive billing refreshes on the client:
RegisterNetEvent("sky_jobs_base:billing:changed", function()
-- Refresh your existing billing view through its authorised server request.
end)
Business state notifications can also occur when the initial snapshot arrives. Refreshes may repeat. Register listeners when your resource starts and load the current data separately: events do not replay changes that happened before your listener existed.