Client Exports

0r-Dispatch — Client Exports

This document describes all client-side export functions for the 0r-dispatch script. Client exports run on the local player's machine and are used to send alerts to dispatch or to read alert data received by this client.


Table of Contents

  • General Information

  • Send911

  • SendAlert

  • GetDispatchAlerts

  • GetSelectedAlerts

  • GetSelectedEmsAlerts

  • VehicleTheft

  • HouseRobbery

  • ATMRobbery

  • ShopRobbery

  • Quick Reference


General Information

Item
Description

Resource name

0r-dispatch

Call format

exports['0r-dispatch']:ExportName(...)

Add the resource as a dependency in your fxmanifest.lua:

Client exports are invoked from client scripts only. When you send an alert (e.g. SendAlert), the event is sent to the server, which then distributes it to all clients whose job is in the alert’s receivers.


Send911

Creates a 911 / civil report-style alert. The player's position, gender, and optional message are sent to dispatch. Typically used from a "Civil Reporting" or "911" style UI.

Parameter
Type
Required
Description

alertLabel

string

Yes

Alert type label (e.g. "civilreporting"). Can match a rule type in settings.

code

string

No

Code (e.g. "10-90").

icon

string

No

Font Awesome icon name (e.g. "fa-phone"). Default: 'fa-hand'.

blipData

table

No

Map blip settings.

takePhoto

boolean

No

If true, a screenshot is taken and attached to the alert.

msg

string

No

The citizen's message; used as the alert description.

blipData fields:

  • blipId (number) — Blip sprite ID. Default: 161

  • blipScale (number) — Blip scale. Default: 1.5

  • blipColor (number) — Blip color. Default: 1

Note: The alert is not sent if the player is in a dispatch exclusion zone.

Example:


SendAlert

Sends a custom dispatch alert. The player's position, weapon, vehicle info (if any), nearby player count, etc. are collected automatically. The alert is delivered to the relevant jobs (e.g. police) according to rules in settings.json and the jobs parameter.

Parameter
Type
Required
Description

alertLabel

string

Yes

Alert type (e.g. "shooting", "vehicleshooting", "custom"). Can match DispatchBlip and AlertCodes in config.

code

string

No

Code (e.g. "10-31").

icon

string

No

Font Awesome icon. Default: 'fa-hand'.

blipData

table

No

Blip settings. Missing fields are filled from Config.DispatchBlip[alertLabel].

takePhoto

boolean

No

Whether to take a screenshot. If nil, Settings.includeImage is used.

jobs

table

No

Job names that should receive the alert (e.g. {"police","ambulance"}). If empty/nil, rule or {"police"} is used.

coords

vector3 / table

No

Alert location. If omitted, the player's current coordinates are used.

blipData example: { blipId = 161, blipColor = 1, blipScale = 1.0, jobs = {"police"} }

Note: No alert is sent in exclusion zones. alertLabel may be defined in Config.DispatchBlip and Config.AlertCodes in shared/config.lua.

Example:


GetDispatchAlerts

Returns the list of all dispatch alerts currently received on this client. The list includes every alert the server has sent to this client.

Returns: table — Each element is an alert object (id, type, title, coords, job, etc.).

Example:


GetSelectedAlerts

Returns alerts filtered by dispatch rules for the given job — i.e. only alerts whose type has that job as a receiver.

Parameter
Type
Required
Description

job

string

Yes

Job name (e.g. "police", "ambulance").

Returns: table — Alert objects for that job.

Example:


GetSelectedEmsAlerts

For EMS use: returns all alerts where the sender's job matches job. Filtered by "who sent this alert" (e.g. alerts sent by ambulance).

Parameter
Type
Required
Description

job

string

Yes

Job name (e.g. "ambulance").

Returns: table — Alert objects where v.job == job.

Example:


VehicleTheft

Creates a vehicle theft alert. Plate, model name, direction, and location are taken from the given vehicle entity. No alert is sent if the vehicletheft rule is disabled or the player is in an exclusion zone. Cooldown applies.

Parameter
Type
Required
Description

Vehicle

entity (vehicle)

Yes

The vehicle to report as stolen (script/vehicle handle).

Example:


HouseRobbery

Sends a house robbery alert. The given coordinates are used as the incident location; the player's gender and heading are included. No alert is sent if the houseRobbery rule is off or the player is in an exclusion zone. Cooldown applies.

Parameter
Type
Required
Description

HouseCoord

vector3 / table

Yes

Incident location (x, y, z).

Example:


ATMRobbery

Sends an ATM robbery alert. The given coordinates are used as the incident location. No alert is sent if the atmRobbery rule is off or the player is in an exclusion zone. Cooldown applies.

Parameter
Type
Required
Description

AtmCoord

vector3 / table

Yes

ATM incident location.

Example:


ShopRobbery

Sends a store / shop robbery alert. The given coordinates are used as the incident location. No alert is sent if the ShopRobbery rule is off or the player is in an exclusion zone. Cooldown applies.

Parameter
Type
Required
Description

ShopCoord

vector3 / table

Yes

Store/incident location.

Example:


Quick Reference

Export
Description

Send911

Civil/911-style alert (with message).

SendAlert

Custom dispatch alert (location, blip, jobs, photo).

GetDispatchAlerts

Full list of alerts on the client.

GetSelectedAlerts

Alerts filtered by job (client data).

GetSelectedEmsAlerts

Alerts sent by a given job (for EMS).

VehicleTheft

Vehicle theft alert.

HouseRobbery

House robbery alert.

ATMRobbery

ATM robbery alert.

ShopRobbery

Store/shop robbery alert.


For server exports, see exports-server.md.

Rules and codes are read from data/settings.json and shared/config.lua.

Last updated