π§© EditTable β Complete Reference
TheEditTable is the heart of XR-MDT customization. It is a globally accessible Lua table that exposes every integration point the script offers β from money handling and database queries to dispatch routing and job-specific logic. Because XR-MDT is Tebex Escrow-protected, you cannot modify core files β but you can modify everything inside the editable/ folder, and the EditTable is the bridge that connects your custom code to the protected core.
π What is the EditTable?
[!IMPORTANT]
Every EditTable function listed below is fully editable. Override any of them to adapt XR-MDT to your serverβs custom scripts, frameworks, or databases.
π File Structure
[!NOTE] Load order matters.editable/server/main.luais loaded first among all editable files, so theBridgeandEditTabletables are available whenlspd.lua,ems.luaetc. are loaded.
π§ Server β Core Module (editable/server/main.lua)
This is the main bridge between XR-MDT and your framework. It contains:
- Framework detection and object initialization (
QBCore,ESX). - The
Bridgeabstraction layer for all framework operations. EditTable.Eventsβ the primary integration points called by the core.EditTable.Functionsβ utility helpers.- Event listeners for dispatch and notifications.
Bridge Functions
TheBridge table provides a framework-agnostic API. These functions are used internally by EditTable and by editable/server/lspd.lua, ems.lua, etc.
Player & Job
Money
Banking (Society)
Items & Inventory
Job Management
UI & Interaction
EditTable.Events
These are the primary integration points. The MDT core calls these functions whenever it needs to perform an action that depends on your serverβs specific setup.EditTable.Events.RemoveMoney
Called when the MDT needs to deduct money from a player (fines, taxes, purchases).
Returns:
boolean β true if successful.
EditTable.Events.HasItem
Called to check if a player possesses a specific item.
Returns:
boolean
EditTable.Events.Query
Every database query in the MDT passes through this function. Override it to use a different SQL library or add query logging.
Returns:
table β Query result rows, or {} on error.
[!WARNING]
If you arenβt using oxmysql, you must override this function. The entire MDT depends on it for all database operations.
EditTable.Events.SendDispatch
Controls how dispatch alerts are routed to players.
[!TIP] Add your webhook logic or external CAD forwarding inside this function after the player loop.
EditTable.Functions (Server)
EditTable.Functions.ErrorCodes (Server)
π Server β LSPD Module (editable/server/lspd.lua)
All police-specific logic: player actions, database queries, and generator functions.
EditTable.LSPD.Functions
GenerateSSN()
Generates a unique Social Security Number for citizens (6-digit numeric by default).
GenerateVIN()
Generates a unique Vehicle Identification Number (12-character alphanumeric).
GenerateWeaponSerial()
Generates a weapon serial number using Config.WeaponSerialization settings.
HandleSentence()
Called when a full sentence (fine + jail) is applied. Handles both online and offline players.
EditTable.LSPD.Events
EditTable.LSPD.Queries
[!NOTE] All queries are framework-aware. The default implementation uses different SQL depending onConfig.Framework('qb'/'qbox'usesplayers,'esx'usesusers). Override the specific query function if your schema differs.
π Server β EMS Module (editable/server/ems.lua)
Medical-specific events and queries for the ambulance/EMS interface.
EditTable.EMS.Events
[!WARNING]EMS_HandleTreatment(used by theApplyTreatmentexport) currently contains hardcoded QB-Core calls (QBCore.Functions.GetPlayerByCitizenId,qb-banking). If you use ESX or a different banking resource, override this function ineditable/server/ems.lua:
EditTable.EMS.Queries
βοΈ Server β DOJ Module (editable/server/doj.lua)
Court system logic β case management, citizen/vehicle lookups, and incident management.
EditTable.DOJ.Queries
Case Management
Citizen & Vehicle Lookups
Citizen Actions
Employee Management
π’ Server β Business Module (editable/server/business.lua)
Business panel logic β employee management, banking queries, and HR operations.
EditTable.Business.Events
EditTable.Business.Queries
Employee Operations
Finance & Banking
[!NOTE] Finance queries depend on thebank_statementstable. If your banking resource uses a different table or schema, override these functions ineditable/server/business.lua.
[!WARNING]Business_HandleBonus(used by theGiveBonusexport) currently contains hardcoded QB-Core calls. If you use ESX or a different framework, override this function:
π Client β Core Module (editable/client/main.lua)
The client-side bridge controls animations, UI initialization, dispatch routing, and targeting zones.
EditTable.ClientEvents
[!TIP] Want a different animation? Change the anim dict and clip name. Want no animation at all? Leave the function body empty.
EditTable.Functions (Client)
Client Error Codes:
Bridge Functions (Client)
π Client β LSPD Module (editable/client/lspd.lua)
Police-specific client commands and keybinds.
Registered Commands
π Quick Start: Customizing EditTable
Example 1 β Custom fine system with Discord logging
Example 2 β Custom jail integration
Example 3 β Custom database driver
Example 4 β Using the Global Logging System
Example 5 β Custom tablet animation
Example 6 β Custom Dispatch Handler (Forward to External CAD)
Β© XR-Core Systems | Professional FiveM Resources
