Server Events
These are server-side events that zephyr_police emits via TriggerEvent. Hook into them from your own resource to react to duty changes, arrests, division updates, and more.
zephyr_police:server:onDuty
Fired when an officer successfully clocks in. Receives the officer’s source ID and their full officer data object.
AddEventHandler('zephyr_police:server:onDuty', function(src, officerData)
print(('Officer %s (%s) is now on duty.'):format(officerData.name, src))
-- Register the unit with your own tracking system here
end)officerData fields:
| Field | Type | Description |
|---|---|---|
name | string | Officer’s display name |
job | string | Job name (e.g. "police") |
grade | number | Current job grade |
division | string|nil | Assigned division ID, or nil if none |
citizenid | string | Character’s citizen ID |
zephyr_police:server:offDuty
Fired when an officer clocks out, disconnects, or is forced off duty.
AddEventHandler('zephyr_police:server:offDuty', function(src, reason)
print(('Officer %s went off duty. Reason: %s'):format(src, reason))
end)| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID of the officer |
reason | string | Why they went off duty — see table below |
Possible reason values:
| Value | Trigger |
|---|---|
"off_duty" | Player manually clocked out |
"forced_off_duty" | Another resource called zephyr_police:server:forceOffDuty |
"disconnect" | Player dropped from the server |
"job_change" | Player’s job was changed to a non-police job |
"job_switch" | Multi-job switch away from police |
"external_duty_off" | External framework duty toggle (e.g. QBX SetJobDuty) |
zephyr_police:server:forceOffDuty
An inbound server event you can trigger from any resource to force a specific officer off duty.
-- Force officer with server ID 5 off duty
TriggerEvent('zephyr_police:server:forceOffDuty', 5, 'custom_reason')| Parameter | Type | Description |
|---|---|---|
targetSrc | number | Server source ID of the officer to force off duty |
reason | string | (optional) Reason string passed to offDuty event |
zephyr_police:server:divisionChanged
Fired when an officer’s division assignment is updated via the Org Suite or SetPlayerDivision export.
AddEventHandler('zephyr_police:server:divisionChanged', function(src, division, grade)
print(('Officer %s assigned to division: %s (grade %s)'):format(src, division, grade))
end)| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID of the officer |
division | string | Division ID (e.g. "swat", "cid") |
grade | number | Division-specific grade rank |
zephyr_police:server:logChargesToMDT
Fired internally after a successful jail sentence. Bridges charge data to the active MDT system (zephyr_mdt, ps-mdt, qb-mdt, etc.).
AddEventHandler('zephyr_police:server:logChargesToMDT', function(targetSrc, charges, officerSrc)
-- charges: table array of charge objects
-- Each charge: { name, fine, jail }
for _, charge in ipairs(charges) do
print(charge.name, charge.fine, charge.jail)
end
end)| Parameter | Type | Description |
|---|---|---|
targetSrc | number | Server source ID of the jailed suspect |
charges | table | Array of normalised charge objects (name, fine, jail) |
officerSrc | number | Server source ID of the arresting officer |
zephyr_police:server:dispatchArrest
Fired internally after a suspect is jailed. Used by dispatch_integration.lua to create a 10-15 dispatch call. You can hook this to log arrests externally.
AddEventHandler('zephyr_police:server:dispatchArrest', function(officerSrc, targetSrc, months)
print(('Officer %s arrested player %s for %s months'):format(officerSrc, targetSrc, months))
end)| Parameter | Type | Description |
|---|---|---|
officerSrc | number | Arresting officer’s server source ID |
targetSrc | number | Jailed suspect’s server source ID |
months | number | Jail sentence in months |
zephyr_police:server:trafficStopStarted
A registered net event fired by the client when an officer initiates a traffic stop. Creates a 10-38 call in zephyr_dispatch automatically.
-- You can hook this to log traffic stop data externally:
AddEventHandler('zephyr_police:server:trafficStopStarted', function()
local src = source
print(('Officer %s started a traffic stop'):format(src))
end)Note: The
plateparameter is provided internally by the client but the event is fired as aRegisterNetEvent. Hook it withAddEventHandleron the server.