๐ 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.
[!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.
[!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:
