Browse docs

Events

React to job, duty, employee, billing and Business changes from your own scripts.

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

server.lua
AddEventHandler("sky_jobs:jobChanged", function(playerId, newJob, oldJob, entry)
    print(("Player %d changed job from %s to %s"):format(playerId, oldJob, newJob))
end)
ArgumentTypeMeaning
playerIdnumberOnline player's server ID
newJobstringNew technical job name
oldJobstringPrevious technical job name
entrytableCurrent 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

server.lua
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)
ArgumentTypeMeaning
playerIdnumberOnline player's server ID
onDutybooleanNew duty state
entrytableCurrent read-only PlayerCache entry
previousJobstring?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

EventArgumentsWhen it is emitted
sky_jobs_base:management:memberAddedplayerId, identifier, jobNameThe online hiring/enrolment path adds a job member.
sky_jobs_base:management:memberRemovedidentifier, jobNameA job employee is removed through management.
sky_jobs_base:multijob:memberRemovedjobName, 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

server.lua
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.

EventArgumentsUse
sky_jobs_base:gradeChangedoldGrade, newGradeManagement changed the online player's grade; each argument contains level and label.
sky_jobs_base:billing:changedNoneRelevant invoices changed; refresh your authorised billing view. The server event with the same name has an invoice argument.
sky_jobs_base:business:stateChangedNoneThe synchronised Business state was applied; refresh your display.
sky_jobs_base:business:historyChangedjobNameThat job's announcement history changed.

For example, receive billing refreshes on the client:

client.lua
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.