Server Events

These events are received by the zephyr_dispatch server from other resources or clients. Use them to create calls, push auto-alerts, and manage units from external scripts.


zephyr_dispatch:server:NewDispatch (ps-dispatch compatible)

The primary integration point for third-party detection scripts. Any resource that currently uses ps-dispatch’s NewDispatch event works without modification.

The call recipients are inferred from data.jobs / data.job. If neither is set, the resource automatically routes the call to police or EMS based on the call code and content.

TriggerServerEvent('zephyr_dispatch:server:NewDispatch', {
    title    = '10-90 - Bank Robbery',
    message  = 'Alarm triggered at Fleeca Bank',
    coords   = vector3(150.26, -1040.45, 29.37),
    street   = 'Alta Street',
    code     = '10-90',
    blip     = 'bankrobbery',           -- blip icon key
    priority = true,                    -- true = P1
    jobs     = { 'leo' },               -- 'leo' = all police jobs, 'ems' = all EMS jobs
})

Parameters

FieldTypeDescription
titlestringCall title shown in the dispatch list.
messagestringSituation description. Can also be built from gender, weapon, vehicle.
coordsvector3World coordinates for the map blip and GPS.
streetstringHuman-readable location label (shown in the call list).
codestringCall code (e.g. '10-90', '10-80'). Auto-inferred if omitted.
blipstringBlip icon key for the map blip.
prioritybooleantrue = P1 (high priority). false / omitted = P3.
jobstableJob type array: 'leo' (all police), 'ems' (all EMS), 'all', or specific job names.
jobstring/tableAlternative to jobs. Accepts a specific job name or an array of job names.
genderstringAppended to message (e.g. 'Male').
weaponstringAppended to message (e.g. 'WEAPON_PISTOL').
vehicletable{ name, plate, color } — appended to message.
speedstringSpeed text, appended to message.

Examples

Shots fired with weapon and suspect description:

TriggerServerEvent('zephyr_dispatch:server:NewDispatch', {
    title   = 'Shots Fired',
    coords  = GetEntityCoords(GetPlayerPed(source)),
    street  = 'Olympic Freeway',
    code    = '10-71',
    blip    = 'shooting',
    priority = false,
    jobs    = { 'leo' },
    gender  = 'Male, black hoodie',
    weapon  = 'WEAPON_ASSAULTRIFLE',
})

Suspicious vehicle with plate:

TriggerServerEvent('zephyr_dispatch:server:NewDispatch', {
    title   = 'Suspicious Vehicle',
    coords  = vector3(300.0, -900.0, 30.0),
    street  = 'Strawberry Avenue',
    code    = '10-34',
    blip    = 'suspicious',
    jobs    = { 'leo' },
    vehicle = {
        name  = 'Sultan',
        plate = 'XYZ 1234',
        color = 'Black',
    },
})

EMS-only medical call:

TriggerServerEvent('zephyr_dispatch:server:NewDispatch', {
    title    = 'Person Down',
    message  = 'Unconscious male near the clothing store',
    coords   = vector3(-700.0, -150.0, 37.0),
    street   = 'Hawick Avenue',
    code     = '10-52',
    blip     = 'civdown',
    priority = true,
    jobs     = { 'ems' },
})

zephyr_dispatch:createCall (client → server)

Sent by the dispatch client when an officer manually creates a call from the tablet. Can also be triggered from a client script to create a call on behalf of a player.

-- Client-side
TriggerServerEvent('zephyr_dispatch:createCall', {
    title    = '10-80 - Vehicle Pursuit',
    message  = 'White Sentinel — Plate: ABC 123 — Heading north on the freeway',
    coords   = GetEntityCoords(cache.ped),
    location = 'Olympic Freeway',
    code     = '10-80',
    codeName = 'pursuitstarted',
    priority = 'P2',
    job      = { 'police', 'sheriff', 'bcso' },
    followPrimary      = true,
    showCallerIdentity = true,
    autoAttachSource   = true,
})
FieldTypeDescription
titlestringCall title.
messagestringSituation description.
coordsvector3World coordinates. Falls back to the triggering player’s position.
locationstringLocation label for the call list.
codestringCall code.
codeNamestringBlip icon key.
prioritystring'P1', 'P2', or 'P3'.
jobtable/stringJob(s) to target.
followPrimarybooleanCall blip follows the primary unit (auto-set for pursuit calls).
showCallerIdentitybooleanAttach the calling officer’s name/callsign to the call.
autoAttachSourcebooleanAutomatically attach the source player to the call as a responding unit.
suppressNotifybooleanCreate the call without sending alert toasts.

zephyr_dispatch:resolveCall

Closes an active call. Only officers whose job is targeted by the call can resolve it.

-- Client-side
TriggerServerEvent('zephyr_dispatch:resolveCall', callId)
ParameterTypeDescription
callIdnumberID of the call to close.

zephyr_dispatch:registerUnit

Registers a player as an on-duty unit in the dispatch system. Normally called automatically on duty-toggle events. Use this if you have a custom duty system that does not fire QBCore:ToggleDuty.

-- Client-side (fires from the on-duty player's client)
TriggerServerEvent('zephyr_dispatch:registerUnit', {
    callsign = '2-A-07',
    status   = 'Available',
    unitType = 'car',
})
FieldTypeDescription
callsignstringUnit callsign to display in the unit tracker.
statusstringInitial availability ('Available', 'Busy', etc).
unitTypestringUnit type for the map icon ('car', 'foot', etc).

zephyr_dispatch:unregisterUnit

Removes the triggering player from the active unit list. Call this when a player goes off duty.

-- Client-side
TriggerServerEvent('zephyr_dispatch:unregisterUnit')

zephyr_dispatch:setCallsign

Sets (and persists) a callsign for the triggering player. Sanitised server-side to alphanumeric + dashes, max 20 characters.

-- Client-side
TriggerServerEvent('zephyr_dispatch:setCallsign', '2-A-07')

zephyr_dispatch:setAvailability

Changes the availability status for the triggering officer. Valid values: 'Available', 'Busy', 'Unavailable', 'On Break' (also accepts 10-8, 10-7, 10-6 codes).

-- Client-side
TriggerServerEvent('zephyr_dispatch:setAvailability', '10-6')
-- Sets status to 'Busy'

zephyr_dispatch:attachUnit

Attaches the triggering officer to a call. Automatically sets a GPS waypoint and, for vehicle pursuits, attaches any other officers in the same vehicle.

-- Client-side
TriggerServerEvent('zephyr_dispatch:attachUnit', callId)

zephyr_dispatch:detachUnit

Removes the triggering officer from a responding call. If the officer was the primary unit on a pursuit, primary is re-assigned to the next longest-attached unit.

-- Client-side
TriggerServerEvent('zephyr_dispatch:detachUnit', callId)