Client Events
These events are sent from the server to clients by zephyr_dispatch. Other resources can listen to them client-side to react to dispatch changes in real time.
zephyr_dispatch:callUpdated
Fired whenever a call is created or updated — new call, unit attached/detached, note added, priority changed, or call closed. All on-duty players whose job matches the call receive this event.
AddEventHandler('zephyr_dispatch:callUpdated', function(call)
-- call.status == 'closed' means the call was just resolved
if call.status == 'closed' then return end
print(('[Dispatch] Call #%s — %s at %s [%s]'):format(
call.id, call.title, call.location, call.priority
))
end)Call object fields
| Field | Type | Description |
|---|---|---|
id | number | Unique call ID. |
title | string | Call title (e.g. "10-80 - Vehicle Pursuit"). |
message | string | Description of the situation. |
code | string | Call code (e.g. "10-80", "911", "10-99"). |
codeName | string | Code name used for blip icon lookup (e.g. "pursuitstarted"). |
location | string | Human-readable location string. |
coords | table | { x, y, z } coordinates. |
priority | string | 'P1', 'P2', or 'P3'. |
status | string | 'active' or 'closed'. |
job | table | Array of job names this call is broadcast to. |
respondingUnits | table | Array of attached unit objects (see below). |
detachedUnits | table | Array of units that previously detached. |
notes | table | Array of dispatcher notes { src, text, time }. |
created | number | Unix timestamp of call creation. |
callerName | string|nil | Name of the reporting officer (if showCallerIdentity was set). |
callerCallsign | string|nil | Callsign of the reporting officer. |
primaryUnit | number|nil | Server ID of the primary unit for pursuit calls. |
primaryName | string|nil | Primary unit’s display name. |
primaryCallsign | string|nil | Primary unit’s callsign. |
followPrimary | boolean | Whether the call blip tracks the primary unit’s position. |
Responding unit object
| Field | Type | Description |
|---|---|---|
unit | number | Server ID of the officer. |
fullname | string | Officer’s full name. |
callsign | string | Officer’s callsign. |
job | string | Job name. |
grade | number | Grade/rank level. |
gradeName | string | Grade/rank name. |
role | string | Unit role on the call (free text). |
attachedAt | number | Unix timestamp when unit attached. |
zephyr_dispatch:callRemoved
Fired when a call is fully removed from the list (after it is resolved/closed). Use this to clean up any local state tied to a specific call ID.
AddEventHandler('zephyr_dispatch:callRemoved', function(callId)
print(('[Dispatch] Call #%s removed from list'):format(callId))
end)| Parameter | Type | Description |
|---|---|---|
callId | number | ID of the removed call. |
zephyr_dispatch:bolosUpdated
Sent to all on-duty police units whenever the BOLO list changes. Delivers the full current BOLO list for the recipient’s group.
AddEventHandler('zephyr_dispatch:bolosUpdated', function(bolos)
for _, bolo in ipairs(bolos) do
if bolo.status ~= 'resolved' then
print(('[BOLO] %s — %s'):format(bolo.type, bolo.plate or bolo.person))
end
end
end)| Parameter | Type | Description |
|---|---|---|
bolos | table | Full current BOLO list for this service group. |
zephyr_dispatch:unitStatusChanged
Sent to all on-duty officers in the same service group when a unit’s status, callsign, or availability changes.
AddEventHandler('zephyr_dispatch:unitStatusChanged', function(unit)
print(('[Units] %s (%s) is now %s'):format(unit.name, unit.callsign, unit.status))
end)| Parameter | Type | Description |
|---|---|---|
unit | table | Updated unit object (see GetActiveUnits export for field list). |
zephyr_dispatch:unitOffDuty
Sent when a unit goes off duty or disconnects.
AddEventHandler('zephyr_dispatch:unitOffDuty', function(source)
print(('[Units] Source %s went off duty'):format(source))
end)| Parameter | Type | Description |
|---|---|---|
source | number | Server ID of the departing unit. |
zephyr_dispatch:client:notify
Sent to on-duty officers when a new call is created. Used by the NUI to display an alert toast and place a map blip.
AddEventHandler('zephyr_dispatch:client:notify', function(payload, callerSrc)
print(('[Alert] %s — %s (%s)'):format(payload.code, payload.title, payload.priority))
end)| Field | Type | Description |
|---|---|---|
id | number | Call ID. |
code | string | Call code. |
codeName | string | Blip icon key. |
title | string | Call title. |
message | string | Call description. |
coords | table | { x, y, z }. |
location | string | Location label. |
priority | string | Priority ('P1'–'P3'). |
alertTime | number | Seconds the toast stays on screen. |
callerName | string|nil | Officer name (if showCallerIdentity = true). |
patientName | string|nil | Patient name for EMS calls. |
zephyr_dispatch:pursuitPrimaryTick
Sent every second to officers attached to an active pursuit call. Carries the current coordinates of the primary unit for the live map blip.
AddEventHandler('zephyr_dispatch:pursuitPrimaryTick', function(payload)
-- payload.callId, payload.coords { x, y, z }, payload.callsign, payload.label
end)zephyr_dispatch:pursuitPrimaryClear
Sent to a unit when the primary unit for a pursuit changes or the unit detaches from the call. The receiving client should remove the pursuit blip.
AddEventHandler('zephyr_dispatch:pursuitPrimaryClear', function(callId)
-- remove blip for callId
end)zephyr_dispatch:callBlipTick
Sent every 2 seconds to all on-duty officers for any call with followPrimary = true. Updates the position of the call’s map blip to follow the primary unit.
AddEventHandler('zephyr_dispatch:callBlipTick', function(payload)
-- payload.callId, payload.coords { x, y, z }, payload.primary
end)zephyr_dispatch:setWaypoint
Sent to an officer automatically when they attach to a call. Sets a GPS waypoint to the call’s coordinates.
AddEventHandler('zephyr_dispatch:setWaypoint', function(callId, coords)
if coords then
SetNewWaypoint(coords.x + 0.0, coords.y + 0.0)
end
end)zephyr_dispatch:jobChat:newMessage
Sent to all officers in the relevant job-chat channel when a new message is posted.
AddEventHandler('zephyr_dispatch:jobChat:newMessage', function(data)
-- data.channelId, data.message { id, ts, from { name, callsign, job }, message }
end)