Browse docs

Emergency Dispatch

Public server-side exports for creating, checking, and removing Emergency Dispatch incidents.

Emergency Dispatch

These exports let server resources create Dispatch App incidents and manage incidents associated with their own source identifiers.

With Config.Dispatch.enabled = true, createDispatch creates a persistent Dispatch App incident. When the master switch is disabled, the same export automatically uses the legacy map dispatch and top-center notification.

createDispatch(title, message, coords, jobs, meta)

ArgumentTypeDescription
titlestringRequired incident title.
messagestringIncident description.
coordsvector3 | tableRequired world position. Tables use { x, y, z }.
jobsstring | string[]One job name or an array of target jobs.
metatable?Optional source, sourceKey, sourceId, and category values.

Returns: table | nil — the created dispatch entry, or nil when validation fails.

server.lua
local dispatch = exports["sky_jobs_base"]:createDispatch(
    "Bank Robbery",
    "Silent alarm triggered at Pacific Standard",
    vector3(235.0, 216.0, 106.0),
    "police",
    {
        source = source,
        sourceKey = "alarm",
        sourceId = "pacific-standard",
        category = "robbery"
    }
)

if dispatch then
    print("Dispatch created:", dispatch.id)
end

The returned entry contains id, title, message, coords, jobs, job, status, createdAt, and the supplied source metadata. Dispatch App incidents also expose an internal centerIncidentId; integrations should continue using their own sourceKey and sourceId.

HasDispatch(sourceKey, sourceId)

Checks whether a non-completed dispatch exists for the exact source key and ID pair.

Returns: boolean

server.lua
local exists = exports["sky_jobs_base"]:HasDispatch("alarm", "pacific-standard")

RemoveDispatchesBySourceAndId(sourceKey, sourceId)

Removes every matching dispatch and closes its linked Dispatch App incident.

Returns: number — the number of removed dispatches.

server.lua
local removed = exports["sky_jobs_base"]:RemoveDispatchesBySourceAndId(
    "alarm",
    "pacific-standard"
)

print("Removed dispatches:", removed)

Use a stable, resource-owned key and ID pair when you need duplicate prevention or later cleanup.