🌐 API - Client Side
External scripts (phone systems, radar systems, robbery resources) can integrate with XR-MDT via client-side exports and server events.📡 Client Exports
createAlert
Spawns an interactive dispatch alert popup visible to specific jobs. This is the primary export for custom alert systems.
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | ✅ | 10-code (e.g. '10-31'). |
title | string | ✅ | Headline displayed in the dispatch panel. |
description | string | ✅ | Detailed context for responding units. |
coords | vector3 | ❌ | World coordinates for the blip. |
sound | string | ❌ | Sound effect name (e.g. 'POLICERobbery'). |
blip | table | ❌ | Blip config: { sprite, scale, color, name }. |
jobs | table | ✅ | Job names that receive the alert (e.g. {'police'}). |
location | string | ❌ | Street / area label (auto-generated if omitted). |
[!WARNING] Thejobsarray is a security gate. Only on-duty players whosejob.namematches an entry injobswill receive the alert. Use{'police'}for LSPD and{'ambulance'}for EMS.
TriggerDispatch
A simplified wrapper that routes to the server dispatch system. Does not require coordinates or blip data.
| Parameter | Type | Description |
|---|---|---|
code | string | Standard 10-code (e.g. '10-90'). |
title | string | Event name. |
description | string | Context description. |
location | string | Street / area label. |
jobs | table | Target job names. |
[!NOTE]TriggerDispatchtriggersTriggerServerEvent('xr-mdt:server:triggerDispatch', data)which then callsEditTable.Events.SendDispatch(data)— fully customizable ineditable/server/main.lua.
AddDispatch
Directly adds a dispatch entry to the local NUI panel without going through the server. Use for client-local alerts.
openTablet
Opens the MDT tablet for the local player programmatically (bypasses item check):
getCurrentCode / updateCode
Read and write the active threat level / alert code:
⚡ Client Events (NetEvents)
xr-mdt:client:open
Received when the server authorizes the tablet to open. Contains the full session payload.
xr-mdt:client:toggleTablet
Trigger the tablet open/close sequence from an external script (e.g., from a usable item):
xr-mdt:client:newDispatch
Sent by the server when a new dispatch arrives. Forwards data to NUI:
xr-mdt:client:onCodeChange
Fires when the threat level code changes. Useful for syncing HUD visuals or sirens:
xr-mdt:client:playSiren
Forces auditory replication on the receiving client:
xr-mdt:client:updateDuty
Sent to update duty status display in NUI (primarily used by ESX duty system):
xr-mdt:client:citizenUpdated
Broadcast to all clients when a citizen’s MDT data changes (e.g., after a new conviction):
xr-mdt:client:updateFleet
Broadcast to all clients after a vehicle ownership transfer:
🎮 Admin Commands (Client)
These commands are available whenConfig.Debug = true:
| Command | Description |
|---|---|
/mdt_debug | Lists all currently registered target zones with their names and coordinates. |
