Browse docs
Emergency Dispatch
Emergency Dispatch
These exports let server resources create Dispatch App incidents and manage incidents associated with their own source identifiers.
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)
| Argument | Type | Description |
|---|---|---|
title | string | Required incident title. |
message | string | Incident description. |
coords | vector3 | table | Required world position. Tables use { x, y, z }. |
jobs | string | string[] | One job name or an array of target jobs. |
meta | table? | Optional source, sourceKey, sourceId, and category values. |
Returns: table | nil — the created dispatch entry, or nil when validation fails.
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
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.
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.