Skip to main content

๐ŸŒ 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] The jobs array is a security gate. Only on-duty players whose job.name matches an entry in jobs will 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] TriggerDispatch triggers TriggerServerEvent('xr-mdt:server:triggerDispatch', data) which then calls EditTable.Events.SendDispatch(data) โ€” fully customizable in editable/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 when Config.Debug = true: