Skip to main content

Configuration

The XR-MDT system operates via multiple modular configuration files found in the configs/ folder. This allows precise tuning for performance, permissions, and layout adjustments without touching core code.

📁 Configuration Files Overview

FilePurpose
configs/config.main.luaCore settings: framework, language, tablet command, item names
configs/config.police.luaPolice job definitions, grades, permissions, penal code
configs/config.ems.luaEMS job settings and medical permissions
configs/config.doj.luaDOJ/Court job settings and grades
configs/config.business.luaBusiness panel job configuration
configs/config.armory.luaArmory system settings and kit definitions
configs/config.webhook.luaDiscord webhook URLs and embed styling
configs/locales/*.luaLanguage files (e.g., en.lua, pl.lua)

🎛️ Main Settings (config.main.lua)

The fundamental structure of the script is driven by config.main.lua.

Framework & Language

ParameterTypeDescription
Config.FrameworkstringForce a framework: 'qb', 'esx', 'qbox', or 'auto' for autodetect.
Config.LanguagestringLocale file to use: 'en', 'pl', etc. Must match a file in configs/locales/.
Config.DebugbooleanEnables verbose console logging and Discord debug webhooks.
Config.ESXPhoneNumberColumnstringColumn name in users table for phone number (ESX only). Default: 'phone_number'.
Config.ESXDutybooleanIf true, tracks ESX duty state separately (required for ESX if you use duty system).

Tablet Access

ParameterTypeDescription
Config.Tablet.CommandstringChat command to open the MDT. Default: 'mdt'.
Config.Tablet.KeystringDefault key binding. Default: 'DELETE'.
Config.InventoryAutoRegisterbooleanAuto-register usable items for inventory scripts via Bridge.
Config.FivemanageTokenstringFiveManage API token for media uploads (mugshots, avatars).

Item Names

Config.Items = {
    tablet        = 'tablet',
    bodycam       = 'bodycam',
    gps           = 'gps',
    document      = 'document',
    tracking_band = 'tracking_band'
}

Module Toggles

Enable or disable each sub-system independently:
Config.EnablePolice   = true  -- NOTE: Internal key is 'EnablePolice', not 'EnableLSPD'
Config.EnableEMS      = true
Config.EnableDOJ      = true
Config.EnableBusiness = true
Config.EnableDispatch = true
[!WARNING] In sv_main.lua the splash screen reads Config.EnablePolice (not Config.EnableLSPD). Use EnablePolice in config.main.lua.

Notification System

Config.Notify = {
    Type = 'ox'  -- Options: 'ox', 'qb', 'esx'
}

🚔 Job-Specific Settings (config.police.lua)

Every police department is defined in Config.PoliceJobs using the job name as the key.

Multi-Faction Architecture

Starting with v2.0, XR-MDT supports multiple police departments within a single resource:
Config.PoliceJobs = {
    ['police'] = {
        DisplayName = 'Los Santos Police Department',
        Theme = 'lspd',
        Colors = {
            primary = '#38bdf8',
            bg = 'rgba(56, 189, 248, 0.1)'
        },
        Grades = {
            ['0'] = {
                permissions = {
                    dashboard_view   = true,
                    profiles_view    = true,
                    reports_create   = true,
                    employees_manage = false
                }
            },
            ['10'] = {
                permissions = {
                    dashboard_view   = true,
                    data_delete      = true,
                    employees_manage = true
                }
            }
        }
    },
    ['sheriff'] = {
        DisplayName = 'Los Santos County Sheriff',
        Theme = 'lssd',
        Colors = {
            primary = '#f59e0b',
            bg = 'rgba(245, 158, 11, 0.1)'
        },
        Grades = { ... }
    }
}
[!TIP] Each faction automatically inherits a unique UI color scheme based on the Colors table. The Theme CSS class is applied to the NUI for visual branding.

Permission Keys Reference

KeyDescription
dashboard_viewAccess to the main dashboard
profiles_viewView citizen profiles
profiles_editEdit citizen profiles (mugshots, notes)
reports_viewView police reports
reports_createCreate new reports
reports_editEdit existing reports
data_deleteDelete records from the system
employees_manageHire, fire, promote employees
warrants_manageIssue and delete warrants
licenses_manageGrant and revoke licenses
armory_accessAccess the weapon armory
logs_viewView audit logs

📹 Bodycam System Settings

The WASM-powered Bodycam engine processes video encoding directly on the client — no server-side FFmpeg required.
Config.Cameras = {
    Resolution  = { width = 1280, height = 720 },
    DefaultFPS  = 12,    -- Active rendering framerate
    IdleFPS     = 0.5,   -- Background buffering framerate
    AllowedJobs = { "police", "pd", "ambulance" }
}
[!WARNING] Setting DefaultFPS too high may cause framerate degradation on low-end client PCs. The encoding is pushed directly to the NUI rendering thread.

🖨️ Hardware & Printers

Physical printer locations are used by the A4 Document Engine. Players must walk to a printer to claim printed documents.
Config.Printers = {
    {
        Coords   = vector3(447.88, -973.86, 30.68),
        Label    = 'LSPD Network Printer',
        Distance = 5.0
    },
    {
        Coords   = vector3(296.31, -592.43, 43.29),
        Label    = 'Sheriff Office Printer',
        Distance = 5.0
    }
}

🔫 Weapon Serialization

See Weapon Serialization for complete details.
Config.WeaponSerialization = {
    Enabled = true,
    Prefix  = 'SN',
    Format  = 'XXXX-XXXX-XXXX'
}

📣 Webhook Configuration (config.webhook.lua)

Webhooks are routed by priority: Specific Type → Job Category → Main Webhook.
Config.Webhooks = {
    Main = 'https://discord.com/api/webhooks/...',

    Types = {
        Money    = '',    -- Financial actions
        Items    = '',    -- Inventory operations
        Database = '',    -- SQL operations (debug only)
        JobChange = '',   -- Job/duty changes
    },

    Jobs = {
        POLICE   = 'https://discord.com/api/webhooks/...',
        EMS      = '',
        DOJ      = '',
        BUSINESS = '',
        System   = '',
    },

    Categories = {
        POLICE   = { Title = '🚔 LSPD',    Color = 3447003  },
        EMS      = { Title = '🚑 EMS',     Color = 3066993  },
        DOJ      = { Title = '⚖️ DOJ',     Color = 15844367 },
        BUSINESS = { Title = '🏢 Business', Color = 15105570 },
        System   = { Title = '⚙️ System',  Color = 9807270  },
    }
}
[!IMPORTANT] Save and restart the entire resource when updating configs/*.lua to re-bind job permissions and locale data correctly.