π§ API β Server Side
Nearly all backend routing integrations occur exclusively inside theeditable/server/ folder without exposing core escrowed code. This page covers server exports, secure event triggers, and admin commands. For the full EditTable reference, see the dedicated EditTable Reference.
π€ Server Exports
All exports are registered ineditable/server/ files and available to any external script via exports['xr-mdt']:ExportName(...).
Logging
| Export | Parameters | Description |
|---|---|---|
AddLog | (source, job, action_type, details, debugType?) | Records an audit log to mdt_logs DB table and forwards to Discord webhook. |
AddLog Parameter Details:
| Parameter | Type | Required | Description |
|---|---|---|---|
source | number | β | Server ID of the player performing the action. |
job | string | β | Job/faction name (e.g. 'police', 'ambulance'). Used for webhook routing. |
action_type | string | β | The action title (e.g. 'Fine Issued', 'Warrant Created'). |
details | string | β | Full descriptive details of the action. |
debugType | string | β | Webhook category key (e.g. 'Money', 'Items', 'Database'). |
Weapons
| Export | Parameters | Returns | Description |
|---|---|---|---|
GenerateWeaponSerial | () | string | Generates a unique serial number based on Config.WeaponSerialization. |
GenerateVin | () | string | Generates a unique VIN (verified against DB for uniqueness). |
Vehicles
| Export | Parameters | Returns | Description |
|---|---|---|---|
AddVehicle | (source, targetId, model, garage, financeData?, ownerOverride?) | boolean, plate, vin | Adds a vehicle to the database with auto-generated plate and VIN. |
ownerOverride can be:
- A citizenid string β assigns to that citizen.
'police'β generates aLSPD XXXplate.'ambulance'β generates anEMS XXXXplate.
Sentences & Medical
| Export | Parameters | Returns | Description |
|---|---|---|---|
AddSentence | (citizenId, fine, jailTime, reason, authorName?) | void | Records a conviction in lspd_convictions and applies effects (fine + jail). |
ApplyTreatment | (citizenId, amount, treatmentName) | void | Bills a patient and applies treatment costs. |
GiveBonus | (citizenId, amount, businessName) | void | Gives a monetary bonus to an employee. |
[!WARNING]AddSentencebroadcastsTriggerClientEvent('xr-mdt:client:citizenUpdated', -1, citizenId)after recording. This refreshes the profile on all open MDT instances.
Device Toggles
These exports bypass item checks and directly trigger device actions:| Export | Parameters | Description |
|---|---|---|
tablet | (source) | Opens the MDT tablet for the specified player. |
bodycam | (source) | Triggers bodycam toggle (respects item check). |
gps | (source) | Triggers GPS toggle (respects item check). |
tracking_band | (source) | Triggers tracking band toggle (respects item check). |
document | (source, item) | Opens a document viewer for the player. |
toggleBodycam | (source) | Force-toggles bodycam (bypasses item check). |
toggleGPS | (source) | Force-toggles GPS (bypasses item check). |
Database Auditor
| Export | Parameters | Returns | Description |
|---|---|---|---|
getDatabaseAuditor | () | XRAuditor table | Returns the database auditor object for validation. |
β‘ Server Events (NetEvents)
xr-mdt:server:triggerDispatch
Force a dispatch notification to all on-duty players in specified jobs. Can be triggered from a client via TriggerServerEvent or from another server script.
| Parameter | Type | Description |
|---|---|---|
data.code | string | 10-code identifier (e.g. '10-99'). |
data.title | string | Headline for the dispatch panel. |
data.description | string | Detailed context. |
data.location | string | Street / area label. |
data.jobs | table | Job names that receive the ping. |
data.coords | table? | {x, y, z} coordinates for blip. |
data.blip | table? | Blip config {sprite, scale, color, name}. |
data.sound | string? | Sound effect name. |
[!TIP] The dispatch is routed throughEditTable.Events.SendDispatch(data)ineditable/server/main.lua. Override that function to add custom behavior (e.g., forward to external CAD, Discord webhook).
xr-mdt:server:triggerNotification
Send a NUI notification directly to a player from any script:
| Parameter | Type | Description |
|---|---|---|
text | string | Notification text. |
type | string | 'success', 'error', or 'info'. |
length | number | Duration in milliseconds. |
xr-mdt:server:requestOpenMDT
Sent by the client when the player presses the MDT keybind or command. Internally validates the playerβs job and triggers xr-mdt:client:open:
π§ Admin Commands (Server)
These commands are registered viaBridge.RegisterCommand() and respect framework-specific permission systems.
| Command | Args | Permission | Description |
|---|---|---|---|
/givevehicle | id model garage? | Admin | Adds a vehicle to the target playerβs database record. |
/testvin | β | Admin | Generates and prints a test VIN. |
/setbodycam | id | Admin | Force-toggles bodycam for a player (bypasses item check). |
/setgps | id | Admin | Toggles GPS for a player. |
βοΈ Conviction System (LSPD)
The sentencing system applies fines and jail simultaneously. Override the logic ineditable/server/lspd.lua:
[!IMPORTANT] For the complete editable API including allEditTable.Events,EditTable.Functions,EditTable.Queries, and per-module breakdowns, see the EditTable Reference β
