> For the complete documentation index, see [llms.txt](https://horizon-scripts.gitbook.io/horizon-scripts-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://horizon-scripts.gitbook.io/horizon-scripts-docs/horizonmdt/installation.md). Agents can also search and read this documentation through its [MCP server](https://horizon-scripts.gitbook.io/horizon-scripts-docs/~gitbook/mcp).

# Installation

HorizonMDT is one FiveM resource with framework adapters. Install the resource named HorizonMDT; Police, Sheriff, FIB, and EMS are departments inside it, not separate MDT resources.

## Requirements

* FiveM with the Cfx Lua 5.4 runtime.
* One supported framework: ESX Legacy, QB-Core, or Qbox.
* oxmysql and a MySQL or MariaDB database.
* An inventory only if you want to open the tablet with an item. Supported adapters and custom inventory contracts are covered in [Integrations and troubleshooting](https://horizon-scripts.gitbook.io/horizon-scripts-docs/horizonmdt/integrations-troubleshooting.md).

## 1. Install and start the resource

1. Copy the HorizonMDT folder to a resources directory. Keep this resource name; item and export examples use it.
2. Start oxmysql, then the one framework running on your server, then HorizonMDT.
3. If you use ox\_inventory, start it before HorizonMDT.

Example for Qbox:

```cfg
ensure oxmysql
ensure qbx_core
ensure ox_inventory # optional
ensure HorizonMDT
```

For ESX, start es\_extended instead of qbx\_core. For QB-Core, use qb-core. Do not start more than one framework adapter for the same server.

## 2. Set up department jobs

The resource contains sample job definitions for Police, Sheriff, FIB, and Ambulance. Review the grades, labels, and pay against your server before importing or merging them.

* **ESX:** import sql/esx\_jobs.sql. It creates or updates the included jobs and grades; inspect the SQL before applying it to a customized live job catalog.
* **QB-Core:** merge install/jobs/qbcore\_jobs.lua into QBShared.Jobs in qb-core/shared/jobs.lua. QBCore uses string grade keys such as \['0'].
* **Qbox:** merge install/jobs/qbox\_jobs.lua into the returned jobs table in qbx\_core/shared/jobs.lua. Qbox uses numeric grade keys such as \[0].

Keep the framework's existing jobs. Do not replace the whole job table with the sample. The MDT maps the common ems job name to its ambulance department by default; make sure the matching job exists in your framework and is allowed in the config.

## 3. Create the database schema

On startup, HorizonMDT uses the active oxmysql connection and creates any missing base tables from sql/police\_tablet.sql (20 tables in this release). Existing tables and records are preserved. The database user needs permission to create tables.

If your database user cannot run DDL during startup, import sql/police\_tablet.sql manually with your database tool, then restart the resource.

## 4. Add the tablet item (optional)

The sample config uses the item name tablet. Use install/README.md as the item definition source and copy install/images/tablet.webp into your inventory's image folder.

* **ox\_inventory:** merge install/items/ox\_inventory.lua into ox\_inventory/data/items.lua. Set Config.TabletUse.ItemRegistration = 'ox\_inventory' and use the item export in that definition.
* **ESX inventory:** import install/items/esx\_items.sql. The sample uses common ESX item columns; adapt them if your schema differs.
* **QB-Core:** merge install/items/qbcore\_items.lua into qb-core/shared/items.lua.
* **Qbox:** add the equivalent item entry to the shared item catalog used by your Qbox inventory.
* **Another inventory:** register the item in that inventory's format and configure its server count export as described in the integration guide.

Keep ItemName identical in the inventory and in Config.TabletUse. If you use an item and a command, RequireItem = true still requires the item when opening from the command or keybind.

The vehicle laptop item is optional. Copy install/images/laptop.webp and define the laptop item only if you enable the vehicle CAD module.

## 5. Configure and verify

Review [Configuration](https://horizon-scripts.gitbook.io/horizon-scripts-docs/horizonmdt/configuration.md) for framework, jobs, inventory, permissions, locales, optional modules, and photo points. The short `shared/config.lua` selects ESX in the delivered development copy; change `Config.Framework` before starting on QB-Core or Qbox. Technical defaults are in `shared/advanced.lua`.

The default command is /mdt; EMS also has /mdtems. Opening is still validated on the server against the player's job, minimum grade, duty policy, and item requirement. After the first start, confirm that the schema is ready and that the resource reports the expected framework and inventory.
