Client Exports#
Client exports run on the local player's machine. Use them to send alerts to dispatch, or to read alerts this client has already received.
Every "send" function is available in two ways — pick whichever fits your script:
- Export — direct call, works everywhere, but throws an error if
0r-dispatchhasn't started yet. - TriggerEvent — fire-and-forget, never throws, works no matter which resource starts first. If
0r-dispatchisn't running yet, the alert is just silently dropped instead of crashing your script.
Both do the exact same thing under the hood.
Setup#
-- fxmanifest.lua
dependencies {
'0r-dispatch',
}
Send911#
Civilian 911 / report-style alert. Uses the player's position and gender automatically; message is the optional text the player typed.
exports['0r-dispatch']:Send911('civilreporting', '10-90', 'fa-phone',
{ blipId = 161, blipScale = 1.5, blipColor = 1 },
false, 'Suspicious vehicle in the park.')
-- same thing, as an event (won't error if 0r-dispatch isn't up yet)
TriggerEvent('0R:Dispatch:TriggerSend911', 'civilreporting', '10-90', 'fa-phone',
{ blipId = 161, blipScale = 1.5, blipColor = 1 },
false, 'Suspicious vehicle in the park.')
Skipped silently if the player is standing in a dispatch exclusion zone.
SendAlert#
General-purpose custom alert. Automatically attaches the player's position, weapon, vehicle (if any), and nearby-player count.
Who receives it, in priority order: jobs argument → data/settings.json rule for alertLabel → blipData.jobs → {"police"}.
exports['0r-dispatch']:SendAlert('shooting', '10-31', 'fa-crosshairs',
{ blipId = 110, blipColor = 37, blipScale = 2.0 },
false, { 'police', 'bcso' }, vector3(100.0, 200.0, 21.0))
-- same thing, as an event
TriggerEvent('0R:Dispatch:TriggerSendAlert', 'shooting', '10-31', 'fa-crosshairs',
{ blipId = 110, blipColor = 37, blipScale = 2.0 },
false, { 'police', 'bcso' }, vector3(100.0, 200.0, 21.0))
Signature: (alertLabel, code, icon, blipData, takePhoto, jobs, coords) — jobs and coords are optional; omit them to fall back to the receivers/location described above.
VehicleTheft#
local veh = GetVehiclePedIsIn(PlayerPedId(), false)
exports['0r-dispatch']:VehicleTheft(veh)
-- or
TriggerEvent('0R:Dispatch:TriggerVehicleTheft', veh)
Plate, model, heading and location are read from the vehicle entity you pass in.
HouseRobbery#
local coords = GetEntityCoords(PlayerPedId())
exports['0r-dispatch']:HouseRobbery(coords)
-- or
TriggerEvent('0R:Dispatch:TriggerHouseRobbery', coords)
ATMRobbery#
local atmCoords = vector3(89.0, 2.0, 68.0)
exports['0r-dispatch']:ATMRobbery(atmCoords)
-- or
TriggerEvent('0R:Dispatch:TriggerATMRobbery', atmCoords)
ShopRobbery#
local shopCoords = GetEntityCoords(PlayerPedId())
exports['0r-dispatch']:ShopRobbery(shopCoords)
-- or
TriggerEvent('0R:Dispatch:TriggerShopRobbery', shopCoords)
Reading alerts (export only)#
These return a value, so they can only be used as exports — a TriggerEvent has no way to hand data back to the caller.
-- every alert this client has received
local alerts = exports['0r-dispatch']:GetDispatchAlerts()
-- alerts (excluding the internal "emsWorkerInjured" type)
local policeAlerts = exports['0r-dispatch']:GetSelectedAlerts('police')
-- alerts sent by a matching job (e.g. anything an ambulance/EMS reported)
local emsAlerts = exports['0r-dispatch']:GetSelectedEmsAlerts('ambulance')
Note:
GetSelectedAlertsdoes not currently filter by thejobargument you pass — it returns every non-EMS alert regardless of job. If you need alerts scoped to a specific job, filter the result yourself for now.
Quick Reference#
| Function | Export | Event | Returns |
|---|---|---|---|
| Send911 | ✅ | 0R:Dispatch:TriggerSend911 | — |
| SendAlert | ✅ | 0R:Dispatch:TriggerSendAlert | — |
| VehicleTheft | ✅ | 0R:Dispatch:TriggerVehicleTheft | — |
| HouseRobbery | ✅ | 0R:Dispatch:TriggerHouseRobbery | — |
| ATMRobbery | ✅ | 0R:Dispatch:TriggerATMRobbery | — |
| ShopRobbery | ✅ | 0R:Dispatch:TriggerShopRobbery | — |
| GetDispatchAlerts | ✅ | — (returns a value) | table |
| GetSelectedAlerts | ✅ | — (returns a value) | table |
| GetSelectedEmsAlerts | ✅ | — (returns a value) | table |
For server-side exports, see exports-server.md. Alert rules and codes live in data/settings.json and shared/config.lua.