Server Exports
zephyr_dispatch exposes six server-side exports for use by other resources.
CreateCall
Creates a dispatch call from a server-side script. This is the recommended approach when creating calls from non-client contexts (e.g. a robbery script’s server-side trigger). Returns the full call object.
local call = exports.zephyr_dispatch:CreateCall(data)Parameters
All fields are optional, but title, message, and coords should always be provided.
| Field | Type | Description |
|---|---|---|
title | string | Call title shown in the dispatch list. |
message | string | Description of the situation. |
coords | vector3/table | World coordinates. Use { x, y, z } or a vector3. |
location | string | Human-readable location label. |
code | string | Call code (e.g. '10-90', '10-80'). Auto-inferred if omitted. |
codeName | string | Blip icon key (e.g. 'bankrobbery', 'pursuitstarted'). |
priority | string | 'P1' (high), 'P2' (medium), 'P3' (low). Defaults to 'P3'. |
job | table/string | Job(s) to receive the call. Defaults to all dispatch jobs. |
source | number | Server ID of the player who triggered the event (0 for non-player). |
callerSource | number | Server ID of the caller (used to show caller identity). |
showCallerIdentity | boolean | Attach officer name/callsign to the call record. |
callerName | string | Override caller name. Used when source is 0 or not a player. |
callerCallsign | string | Override caller callsign. |
callerJob | string | Override caller job label. |
followPrimary | boolean | Call blip tracks the primary unit (auto-set for 10-80 code). |
autoAttachSource | boolean | Attach the source player to the call automatically. |
suppressNotify | boolean | Create the call silently — no alert toasts or NUI notifications. |
extraInfo | table | Additional info items: { { info = "string" }, ... }. |
patientSource | number | For EMS calls: server ID of the downed patient. |
patientName | string | Patient display name for EMS calls. |
patientStatus | string | Patient status text (e.g. 'Critical'). |
Returns: table — The created call object.
Examples
Basic robbery call from a server script:
local coords = vector3(150.26, -1040.45, 29.37)
local call = exports.zephyr_dispatch:CreateCall({
title = '10-90 - Fleeca Bank Robbery',
message = 'Silent alarm triggered — 2-3 armed suspects inside',
coords = coords,
location = 'Alta Street / Fleeca Bank',
code = '10-90',
codeName = 'bankrobbery',
priority = 'P1',
job = { 'police', 'sheriff', 'bcso', 'sasp', 'lspd', 'sahp' },
})
print('Created call #' .. call.id)Officer distress (10-99) showing caller identity:
exports.zephyr_dispatch:CreateCall({
title = '10-99 - Officer in Distress',
message = 'Officer requesting immediate assistance',
coords = GetEntityCoords(GetPlayerPed(officerSrc)),
location = 'Pillbox Hill',
code = '10-99',
codeName = 'officerdown',
priority = 'P1',
job = { 'police', 'sheriff', 'bcso', 'ambulance' },
source = officerSrc,
showCallerIdentity = true,
autoAttachSource = true,
})Silent background call (no toast notification):
exports.zephyr_dispatch:CreateCall({
title = '10-34 - Suspicious Activity',
message = 'ANPR flagged stolen vehicle in area',
coords = suspectCoords,
location = 'Davis Avenue',
code = '10-34',
priority = 'P3',
job = { 'police' },
suppressNotify = true,
})GetCalls
Returns all currently active dispatch calls. Optionally filter by a specific job name.
local calls = exports.zephyr_dispatch:GetCalls()
-- or filter by job:
local policeCalls = exports.zephyr_dispatch:GetCalls('police')Parameters
| Parameter | Type | Description |
|---|---|---|
jobFilter | string | Optional. Return only calls that target this specific job name. |
Returns: table — Array of active call objects. See callUpdated event for field list.
Example
local calls = exports.zephyr_dispatch:GetCalls('police')
for _, call in ipairs(calls) do
if call.status == 'active' then
print(('#%d %s — %s'):format(call.id, call.code, call.location))
end
endRegisterUnit
Registers a player as an on-duty unit in the dispatch system. This is called automatically on duty-toggle events but can be called manually if you use a custom duty system.
exports.zephyr_dispatch:RegisterUnit(src, data)| Parameter | Type | Description |
|---|---|---|
src | number | Server ID of the player to register. |
data | table | Optional unit data (see table below). |
data Field | Type | Description |
|---|---|---|
callsign | string | Initial callsign. |
status | string | Initial availability status. |
unitType | string | Unit type for the map icon ('car', 'foot'). |
Example
-- Register an officer when a custom duty system turns them on
AddEventHandler('myCustomDuty:onDuty', function(src)
exports.zephyr_dispatch:RegisterUnit(src, { status = 'Available' })
end)UnregisterUnit
Removes a player from the active unit list. Call this when a player goes off duty.
exports.zephyr_dispatch:UnregisterUnit(src)| Parameter | Type | Description |
|---|---|---|
src | number | Server ID of the player to unregister. |
GetActiveUnits
Returns the full table of all currently registered on-duty units, keyed by server ID.
local units = exports.zephyr_dispatch:GetActiveUnits()Returns: table — Map of [source] = unit objects.
Unit object fields
| Field | Type | Description |
|---|---|---|
source | number | Server ID. |
name | string | Full name. |
callsign | string | Officer callsign. |
job | string | Job name (normalized, lowercase). |
jobLabel | string | Job display label. |
grade | number | Grade level. |
gradeName | string | Grade name. |
status | string | Availability status ('Available', 'Busy', etc.). |
unitType | string | Unit type string. |
identifier | string | Player citizenid. |
coords | table | Last known { x, y, z } or nil. |
location | string | Last known location label. |
locationUpdatedAt | number | Unix timestamp of last location update. |
Example
local units = exports.zephyr_dispatch:GetActiveUnits()
local count = 0
for _, unit in pairs(units) do
if unit.job == 'police' then
count = count + 1
end
end
print('Online police units: ' .. count)IsUnitOnDuty
Returns whether a player is currently registered as an on-duty unit in dispatch.
local onDuty = exports.zephyr_dispatch:IsUnitOnDuty(src)| Parameter | Type | Description |
|---|---|---|
src | number | Server ID to check. |
Returns: boolean
Example
RegisterNetEvent('myResource:doSomething', function()
local src = source
if not exports.zephyr_dispatch:IsUnitOnDuty(src) then
TriggerClientEvent('ox_lib:notify', src, { description = 'You must be on duty.', type = 'error' })
return
end
-- ... continue
end)