Skip to main content

🧩 EditTable β€” Complete Reference

The EditTable 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.lua is loaded first among all editable files, so the Bridge and EditTable tables are available when lspd.lua, ems.lua etc. 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 Bridge abstraction 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

The Bridge 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 on Config.Framework ('qb'/'qbox' uses players, 'esx' uses users). 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 the ApplyTreatment export) currently contains hardcoded QB-Core calls (QBCore.Functions.GetPlayerByCitizenId, qb-banking). If you use ESX or a different banking resource, override this function in editable/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 the bank_statements table. If your banking resource uses a different table or schema, override these functions in editable/server/business.lua.
[!WARNING] Business_HandleBonus (used by the GiveBonus export) 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