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.


General Information

Resource name 0r-dispatch

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

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

dependencies {
    '0r-dispatch',
}

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.

Parameters:

  • alertLabel (string) — Required. Alert type label (e.g. "civilreporting"). Can match a rule type in settings.

  • code (string) — Optional. Code (e.g. "10-90").

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

  • blipData (table) — Optional. Map blip settings.

  • takePhoto (boolean) — Optional. If true, a screenshot is taken and attached to the alert.

  • msg (string) — Optional. 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.

Parameters:

  • alertLabel (string) — Required. Alert type (e.g. "shooting", "vehicleshooting", "custom"). Can match DispatchBlip and AlertCodes in config.

  • code (string) — Optional. Code (e.g. "10-31").

  • icon (string) — Optional. Font Awesome icon. Default: 'fa-hand'.

  • blipData (table) — Optional. Blip settings. Missing fields are filled from Config.DispatchBlip[alertLabel].

  • takePhoto (boolean) — Optional. Whether to take a screenshot. If nil, Settings.includeImage is used.

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

  • coords (vector3 / table) — Optional. 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.

Examples:


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:

  • job (string) — Required. 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:

  • job (string) — Required. 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:

  • Vehicle (entity) — Required. 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:

  • HouseCoord (vector3 / table) — Required. 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:

  • AtmCoord (vector3 / table) — Required. 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:

  • ShopCoord (vector3 / table) — Required. Store/incident location.

Example:


Quick Reference

  • 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.