Events
Net events your resources can listen to or trigger.
Only events that form a stable integration surface are listed here.
NUI callback channels and lib.callback registrations are internal to
the tablet UI and are subject to change without notice.
Client events (listen)
These fire on the client. Use RegisterNetEvent plus AddEventHandler.
nx_employeemanagement:openTablet
Triggered by the server when the jobtablet item is used through
inventories that do not call the client export directly (for example
qb-inventory). The handler opens the tablet UI.
RegisterNetEvent('nx_employeemanagement:openTablet', function()
-- Tablet UI opens automatically.
-- Listen here if you need to synchronize other UI on open.
end)While Config.LBTablet.Enabled is true this event is received and
ignored. The app inside LB Tablet is the only way to open the UI, so an
item left in your inventory config does nothing instead of erroring.
nx_employeemanagement:offerPrompt
Sent to a candidate when a business offers them a job, and again on
login for offers still pending (Config.HireOffers.PromptOnLogin). The
resource shows the Accept / Decline / Later prompt itself; listen if you
want to mirror the offer somewhere else, such as a phone app.
RegisterNetEvent('nx_employeemanagement:offerPrompt', function(offer)
-- offer.id, offer.job, offer.jobLabel, offer.grade, offer.gradeLabel,
-- offer.issuerName, offer.message, offer.expiresAt (ms),
-- offer.hourlyRateHint, offer.replacesJob (label of the job it replaces, if any)
end)nx_employeemanagement:permissionsChanged
Sent to every client after a boss saves the Permissions tab. The argument is the job whose grants changed. The resource uses it to refresh what each player can open, including the LB Tablet app icon.
RegisterNetEvent('nx_employeemanagement:permissionsChanged', function(job)
-- re-check HasRankPermission for players of this job if you cache it
end)Server events (trigger)
These net events are handled on the server. Trigger them from the
client with TriggerServerEvent.
nx_employeemanagement:startTracking
Mark a job as the one the player is working. The server validates that the caller is currently employed in that job before writing. Hours follow the player's live framework job anyway, so this event is only kept for older setups and never resets any hours.
TriggerServerEvent('nx_employeemanagement:startTracking', 'police')The resource already fires this on esx:playerLoaded,
esx:setJob, QBCore:Client:OnPlayerLoaded, and
QBCore:Client:OnJobUpdate. Trigger it manually only if your setup
does not emit those framework events.
Resetting hours
nx_employeemanagement:resetHours is no longer a net event, so
TriggerServerEvent with that name does nothing. Hours are reset from
the tablet's employee list, or from nx_computer's Employees app, by a
player with the employees grant. Unpaid hours are always kept.
Server events (listen)
These fire on the server only, through TriggerEvent, so clients can
never fake them. Listen with AddEventHandler in a server script. Each
handler gets one table. Identifiers are framework identifiers (ESX
identifier, QBCore / QBox citizenid).
AddEventHandler('nx_employeemanagement:server:payout', function(data)
print(('%s paid %s to %s (%s)'):format(data.job, data.amount, data.identifier, data.kind))
end)| Event | Fires when | Fields |
|---|---|---|
nx_employeemanagement:server:payout | Money reaches an employee | job, identifier, amount, kind (salary, invoice or bonus), delivery (paid, queued for an offline player, or delivered when a queued payment arrives on login), txId, runId, invoiceId |
nx_employeemanagement:server:payrollRun | A payroll run finishes (AutoPay, Pay Now or RunPayroll) | runId, job, status, paid, queued, insufficient, failed, total |
nx_employeemanagement:server:invoiceChanged | An invoice is submitted, approved, rejected or paid | invoiceId, job, identifier, status (pending, approved, rejected, paid) |
nx_employeemanagement:server:staffChanged | Someone is hired, changes grade or is fired | job, identifier, kind (hired, grade, fired), grade, actorIdentifier |
nx_employeemanagement:server:offerChanged | A job offer is created or changes state | offerId, job, candidateIdentifier, issuerIdentifier, status (pending, accepted, declined, cancelled, expired, failed) |
nx_employeemanagement:server:permissionsChanged | A boss saves the Permissions tab | job |
nx_employeemanagement:server:societyChanged | Another script posts a row with AddCompanyTransaction | job, id, direction, amount, category, resource, moved |
Fields that don't apply to a given payment (runId outside a payroll
run, invoiceId for a salary) are nil.