Kartik Scripts

FAQ

Here you can find quick troubleshooting guides and answers to frequently asked questions regarding MDT Dispatch V2.

🔴 Error: attempt to index a nil value (global 'ESX')

If you are running an ESX-based server and see errors related to ESX being nil, it means your resource manifest is not loading the ESX integration scripts.

🛠️ Solution:

  1. Open the fxmanifest.lua file of your kartik-mdt resource.
  2. Locate the shared_scripts section:
shared_scripts {
    -- '@es_extended/imports.lua', -- Import ESX functions and PlayerData
    -- '@es_extended/locale.lua', -- Import the Locale system
    '@ox_lib/init.lua',
    -- ...
}
  1. Remove the comment hyphens (--) from the two ESX lines so they are loaded on startup:
shared_scripts {
    '@es_extended/imports.lua', -- Import ESX functions and PlayerData
    '@es_extended/locale.lua', -- Import the Locale system
    '@ox_lib/init.lua',
    -- ...
}
  1. Save the file and restart your server/resource.

🏢 Department Access & Setup

How do I set up Department Access for ranks?

  1. Use the /mdt-admin command in-game.
  2. Grant the user Department Command Access.
  3. Set your job in the MDT to the Designated Managed Rank or above.
  4. Open the MDT and click the Paint type icon (Department Settings).
  5. On the right-hand side, you can configure which ranks have access to each MDT feature.

📡 Dispatch Configuration

How do I customize the Dispatch UI?

  1. Use the /opendispatch command to open the Dispatch UI.
  2. Navigate to Settings.
  3. From there, you can customize the Dispatch UI layout and other available options.

I disabled dispatch in the settings, but it’s still running on the server. Why?

The settings in the Dispatch UI are individual client-side preferences (such as disabling HUD visibility or sounds for a single player).

To fully disable the inbuilt dispatch system for the entire server (e.g., if you want to use a separate external dispatch resource):

  1. Open the file shared/config_dispatch.lua.
  2. Locate Config.UseInbuiltDispatch.
  3. Set it to false:
    Config.UseInbuiltDispatch = false
  4. Save the file and restart the server.

🔗 MDT & Dispatch Integration

Why is the tracker not working for a custom job?

If you create a custom job and the tracker is not updating or working:

  1. Open your MDT config.lua (located in shared/config.lua).
  2. Locate Config.TrackerShareGroups.
  3. Add your custom job code to this table.
  4. This enables tracker sharing and related permissions for that job.

Why is my custom job not receiving dispatch notifications/alerts?

If your custom job is not receiving dispatch alerts:

  1. Open client/open/alerts.lua.
  2. Locate the dispatch alert you want to modify.
  3. Add your custom job code to the list of allowed jobs for that alert (under the jobs table/attribute).
  4. Save the file.
  5. Restart the server.

🏢 Multiple Departments & Data Sharing

Why do I have to switch departments to view "shared" data?

If a job is assigned to more than one department (for example, its own private department and a common one), that player gets a department dropdown in the /mdt header and has to switch to see each department's data. This confuses people who expected everything in one combined view, but it is working as intended.

The key concept: a department is a self-contained container for data. Records, dispatch, dashboard, roster, and penal codes all live inside the department they were created in. Assigning a job to multiple departments does not merge those containers into one feed, it just gives that job permission to open each one and switch between them.

So the switching only happens because the job is a member of multiple departments. To decide what you actually want:

  • You want truly shared data (no switching): Put all the jobs into a single common department (e.g. Law Enforcement) and set it as their Primary Department. Everyone then sees the same records with nothing to switch.
  • You want separate data per job: Give each job its own department. Each stays private.
  • You see a switcher and didn't want one: That job is assigned to multiple departments. Remove the extra department(s) from that job in /mdt-admin so it belongs to only the one you want.

In short, you don't switch to view shared data, you switch because the job belongs to multiple departments. Genuinely shared data means one department for everyone, and there's nothing to switch.


⚖️ Penal Code Syncing Issues

Why are penal codes not syncing or showing up on the PD side?

If penal codes do not appear in the MDT for your officers, it is usually because of a department mismatch.

By default, the Penal Codes.sql file inserts all penal codes with 'police' as the department ID. If your jobs are configured with other department IDs, the penal codes will not show up.

🛠️ Solutions:

  • Option A: Copy to all departments Run an SQL query to insert or update penal codes for all your active department IDs (e.g., duplicate the records in mdt_penal_code and assign them to lspd, bcso, sasp, etc.).
  • Option B: Assign a common department
    1. Create a common department (e.g., ID police) in /mdt-admin for all your PD jobs.
    2. Assign this department as the Primary Department (represented by the star icon) for each police job in the clearance settings.
    3. Ensure that the penal codes in the mdt_penal_code table have their department column set to that common department's ID.

⚖️ Jailing & Fining/Billing Issues

Why are the Jail and Fine functions not working or not detected from the MDT?

If the jail or fine actions are not triggering or aren't being detected by the MDT, please check the following:

  1. Check the Bridge Folder: Make sure that support for your jail and billing scripts is present in the bridge folder of the kartik-mdt resource. If your specific scripts are not supported out of the box, you can add support for them by writing the custom integration inside the bridge folder. Feel free to provide the integration code to the developer so it can be included in the next official update!

  2. Verify Resource Startup Order: To ensure that the MDT correctly detects your jail and billing scripts, kartik-mdt must be started after those resources. Ensure that your server.cfg starts kartik-mdt at the very end of your resource startup sequence.

On this page