Server Exports

0r-Dispatch — Server Exports

This document describes all server-side export functions for the 0r-dispatch script. Server exports run only on the server and are used to trigger custom alerts for specific players or to read the server’s report list.


Table of Contents

  • General Information

  • SendAlert

  • Reports

  • GetSelectedAlerts

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

dependencies {
    '0r-dispatch',
}

Server exports must be called from server scripts only (e.g. other resources’ server-side Lua). They are typically used to send a custom alert as if a specific player had reported it, or to read the global list of dispatch reports.


SendAlert

Triggers a custom dispatch alert for the given player (source). On that player’s client, the 0R:Dispatch:SendCustomAlert event runs; the player uses their own position and info to send the alert to the server. The server then stores it as type custom and distributes it to the configured jobs.

Parameter
Type
Required
Description

source

number

Yes

Target player's server id.

alertLabel

string

Yes

Alert title/label (e.g. "ATM Robbery").

code

string

Yes

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

icon

string

Yes

Font Awesome icon (e.g. "fa-dollar-sign").

jobs

table

Yes

Job names that should receive the alert.

blipId

number

No

Blip sprite ID to show on the map.

Example:


Reports

Returns the table of all dispatch reports (alerts) held on the server. Reports are updated with every alert received via the 0R:Dispatch:SendAlert event.

Returns: table — All report/alert records (id, type, coords, job, title, etc.).

Example:


GetSelectedAlerts

From the server’s Reports list, returns alerts that the given job should receive according to the dispatch rules (receivers).

Parameter
Type
Required
Description

job

string

Yes

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

Returns: table — Alert objects for that job.

Example:


Quick Reference

Export
Description

SendAlert

Triggers a custom alert for a specific player.

Reports

Full list of reports on the server.

GetSelectedAlerts

Alerts filtered by job (server data).


For client exports, see exports-client.md.

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

Last updated