zephyr_dispatchEventsClient

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

FieldTypeDescription
idnumberUnique call ID.
titlestringCall title (e.g. "10-80 - Vehicle Pursuit").
messagestringDescription of the situation.
codestringCall code (e.g. "10-80", "911", "10-99").
codeNamestringCode name used for blip icon lookup (e.g. "pursuitstarted").
locationstringHuman-readable location string.
coordstable{ x, y, z } coordinates.
prioritystring'P1', 'P2', or 'P3'.
statusstring'active' or 'closed'.
jobtableArray of job names this call is broadcast to.
respondingUnitstableArray of attached unit objects (see below).
detachedUnitstableArray of units that previously detached.
notestableArray of dispatcher notes { src, text, time }.
creatednumberUnix timestamp of call creation.
callerNamestring|nilName of the reporting officer (if showCallerIdentity was set).
callerCallsignstring|nilCallsign of the reporting officer.
primaryUnitnumber|nilServer ID of the primary unit for pursuit calls.
primaryNamestring|nilPrimary unit’s display name.
primaryCallsignstring|nilPrimary unit’s callsign.
followPrimarybooleanWhether the call blip tracks the primary unit’s position.

Responding unit object

FieldTypeDescription
unitnumberServer ID of the officer.
fullnamestringOfficer’s full name.
callsignstringOfficer’s callsign.
jobstringJob name.
gradenumberGrade/rank level.
gradeNamestringGrade/rank name.
rolestringUnit role on the call (free text).
attachedAtnumberUnix 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)
ParameterTypeDescription
callIdnumberID 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)
ParameterTypeDescription
bolostableFull 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)
ParameterTypeDescription
unittableUpdated 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)
ParameterTypeDescription
sourcenumberServer 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)
FieldTypeDescription
idnumberCall ID.
codestringCall code.
codeNamestringBlip icon key.
titlestringCall title.
messagestringCall description.
coordstable{ x, y, z }.
locationstringLocation label.
prioritystringPriority ('P1''P3').
alertTimenumberSeconds the toast stays on screen.
callerNamestring|nilOfficer name (if showCallerIdentity = true).
patientNamestring|nilPatient 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)