> For the complete documentation index, see [llms.txt](https://wiki.qfdevelopers.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.qfdevelopers.com/scripts/editor-22/configuration.md).

# Configuration

Page dedicated to how to configure our Mechanic MDT \[V2]

## Languages

The language of the tablet is set inside `Config.NUI`.

* `en-US`: English
* `fr-FR`: French
* `pl-PL`: Polish
* `de-DE`: German
* `es-ES`: Spanish
* `pt-PT`: Portuguese
* `ja-JP`: Japanese
* `it-IT`: Italian
* `ko-KR`: Korean

```lua
Config.NUI = {
    defaultLangCode = "en-US",
    -- Languages offered in the tablet's own language switcher.
    langs = {
        { code = "en-US", name = "English", iconUrl = "https://.../gb.webp" },
        { code = "pl-PL", name = "Polski",  iconUrl = "https://.../pl.webp" },
    }
}
```

### Commands & Keybinds

**General**

* `/qf_mdt_mechanic_v2` (DELETE): Toggle the MDT Dashboard.
* `/qf_mdt_mechanic_v2badge` (B): Show/Hide Employee Badge. `/badge` works as a short alias.
* `/bodycam`: Toggle the bodycam overlay. `/showbodycam` and `/hidebodycam` force one state.

**Dispatch**

* `/qf_mdt_mechanic_v2_fastgps` (E): Set the GPS to the latest dispatch alert.
* `/qf_mdt_mechanic_v2_dispatch` (HOME): Open the MDT straight on the dispatch page.
* `/qf_mdt_mechanic_v2_alert_accept` (Z): Accept the latest job on screen.
* `/qf_mdt_mechanic_v2_alert_dismiss` (O): Hide the latest job on screen, for you only.
* `/qf_mdt_mechanic_v2_alert_expand` (J): Show the details of the latest job on screen.
* `/mechlocation [note]`: Report your position to the workshop.
* `/mechpanic [note]`: Panic button, off by default.

**Citizens**

* `/913 <what happened>`: Call a mechanic or a tow.

**Camera Mode**

* `/qf_mdt_mechanic_v2_capturephoto` (ENTER): Start capturing a photo.
* `/qf_mdt_mechanic_v2_blocknuifocus` (L-ALT): Block the NUI focus.
* `/qf_mdt_mechanic_v2_cameratakephoto` (SPACE): Take the photo.
* `/qf_mdt_mechanic_v2_cameratogglefocus` (L-ALT): Toggle mouse focus.
* `/qf_mdt_mechanic_v2_cameratoggleflashlight` (F): Toggle camera flashlight.
* `/qf_mdt_mechanic_v2_cameratoggleside` (R): Switch between Front/Back camera.

{% hint style="info" %} <mark style="color:$info;">Note: Both the keys and the command names come from</mark> <mark style="color:$info;">`Config.ToggleMDT`</mark><mark style="color:$info;">,</mark> <mark style="color:$info;">`Config.Camera`</mark><mark style="color:$info;">,</mark> <mark style="color:$info;">`Config.Badge`</mark> <mark style="color:$info;">and</mark> <mark style="color:$info;">`Config.Dispatch`</mark> <mark style="color:$info;">in</mark> <mark style="color:$info;">`config/config.lua`</mark> <mark style="color:$info;">— the names above are the defaults.</mark>
{% endhint %}

***

## Job & Ranks

`Config.Jobs` decides which framework jobs may open the tablet (see Several workshops on one tablet below), and `Config.Grades` supplies the rank labels shown inside it. The `id` values **must** match the grade integers in your framework.

```lua
Config.Jobs = { ['mechanic'] = true }

Config.Grades = {
    { id = 0, name = "Recruit" },
    { id = 1, name = "Novice" },
    { id = 2, name = "Experienced" },
    { id = 3, name = "Leader" },
    { id = 4, name = "Boss" }
}

Config.Officers = {
    fireJob = "unemployed", -- job given to a fired employee
    fireGrade = 0,
    KickFromDutyJob = {     -- optional off-duty job
        enabled = false,
        name = "offmechanic"
    }
}
```

## Several workshops on one tablet (`Config.Jobs`)

One resource can serve more than one workshop, each with its own name, colour, ranks, society and radio codes. With a single job nothing changes and there is nothing to configure:

```lua
Config.Jobs = { ['mechanic'] = true }
```

To describe a workshop, replace `true` with a table. Every field is optional and falls back to the matching global setting, so you only write down what differs:

```lua
Config.Jobs = {
    ['mechanic'] = {
        primary = true,              -- owns every row written before more jobs were added
    },
    ['bennys'] = {
        fractionName     = "BENNYS",
        fractionFullName = "Benny's Original Motor Works",
        color            = { 250, 170, 20 },
        society          = { name = "society_bennys", jobname = "bennys", label = "BENNYS" },
        sharedWith       = { 'mechanic' },
    },
}
```

The full list of fields is documented above `Config.Jobs` in `config/config.lua` (name, colour, logo, `grades`, `requiredGrades`, `society`, `officers`, `billingLimits`, `bodyCam`, `dispatchUnits`, `vehicles`, `stations`, `sharedWith` and more).

{% hint style="warning" %}
Only the primary job inherits `Config.Society`. Every other job falls back to `society_<job>`, so it never pays into another workshop's account. A workshop whose ranks are not 0–4 needs its own `requiredGrades`.
{% endhint %}

`sharedWith` is directional: `['mechanic'] = { sharedWith = { 'bennys' } }` lets mechanic see bennys's workers on the list and the map, not the other way round. Set it on both sides for mutual visibility, or use `sharedWith = true` to see every job.

### What is kept per job (`Config.PerJobData`)

```lua
Config.PerJobData = {
    announcements = true,
    radioCodes    = true,
    gallery       = true,
    auditLogs     = true,
    tasks         = true,

    dispatch      = false,
}
```

The modules set to `true` keep their rows per job; announcements, radio codes, gallery, audit log and repair tasks are kept apart per workshop. With one job nothing changes, everything already in the database is handed to it on the first start.

`dispatch = false` is one shared dispatch for every job, which is how the tablet has always worked, and it defaults to `false` when the key is missing. Set it to `true` and each workshop gets its own calls, patrols, units and actions. Calls raised from the tablet or with the quick commands belong to the workshop that raised them; automatic alerts, the civilian line and calls from other resources stay visible to everyone. Patrols and boards follow `sharedWith` only when it is set on **both** sides.

## Society & Billing

```lua
Config.Society = {
    name = "society_mechanic",
    jobname = "mechanic",
    label = "LSC",
    percentToBoss = 0.80,   -- share of an invoice that goes to the company
    percentToWorker = 0.20, -- share that goes to the employee who issued it
}
```

`Config.Billings` and `Config.Banks` are long lists of supported third-party billing and banking resources — set exactly one entry in each to `true` to bridge invoices and society money into the resource you already run. Leave everything `false` to use the framework's own society account.

## Service Price List

`Config.FineList` drives the price list used when issuing an invoice. The categories and their items are entirely yours to change.

```lua
Config.FineList = {
    {
        id = "1",
        label = "Repair & Maintenance Services",
        items = {
            { id = "1", label = "Standard Repair",      fine = 6000 },
            { id = "2", label = "Engine Overhaul",      fine = 6500 },
            { id = "3", label = "Bodywork & Painting",  fine = 5000 },
        }
    }
}
```

`Config.BillingLimits` caps how much a single invoice may be worth, per grade.

## QF Banking V2 Billing (`Config.Integrations`)

The tablet can use the billing of our [Banking \[V2\]](https://wiki.qfdevelopers.com/scripts/banking-v2.md) as the place where its price list lives and where its bills are issued and paid. It is **off by default**; without it nothing changes.

1. In the bank: **Admin → Billing → Service tablets**, switch on **mechanic**, pick its billing faction (your `mechanic` job) and keep the resource name `qf_mdt_mechanic_v2`. On the first switch-on the bank copies `Config.FineList` (export `GetFineCatalogue`) into the faction's tariff.
2. In `config/config.lua`:

```lua
Config.Integrations = {
    QFBanking = { enabled = true, resource = 'qf_banking_v2' },
}
```

While both are on:

* the invoice list in the tablet is the faction's tariff from the bank, refreshed in open tablets when it is edited there,
* an invoice is issued as one bank invoice priced by the bank's tariff on the server; the prices sent by the tablet are not used. Custom items become custom lines, accepted when the faction allows them in the bank. `Config.Billings` is not used for these invoices, and the client does not have to be online,
* the tablet keeps its own history (`qf_mdt_mechanic_v2_fines.bank_bill_id`, added automatically) and shows each invoice's status from the bank: awaiting acceptance, unpaid, paid, rejected or canceled,
* deleting or clearing invoices cancels their bank invoices that are still open. Paid invoices stay paid.

{% hint style="info" %}
If the bank is stopped or the tablet is switched off there, the MDT goes back to its own list and `Config.Billings`. Every bank call is protected, so a bank restart never breaks the tablet.
{% endhint %}

## Repair Jobs (`Config.Tasks`)

The tablet generates repair jobs around the map that employees can accept from the Tasks page. A job spawns a client vehicle with a specific fault, and the employee has to carry out the steps on the right part of the car.

```lua
Config.Tasks = {
    UseProgressBar = true,
    ManagementGrade = 3,        -- grade required to manage jobs
    RefreshInterval = 10,       -- minutes between job refreshes
    MaxAvailableJobs = 4,       -- jobs offered at the same time
    JobsGeneratedPerRefresh = { min = 1, max = 3 },
    VehicleDeleteDelay = 30000, -- ms before an abandoned job vehicle despawns

    EnableClientPeds = true,    -- spawn the waiting client next to the vehicle
    CustomTowScript = {
        jo_towtruck = true,     -- hand recovery jobs over to jo_towtruck
    },

    PaymentAccount = 'bank',    -- where the payout lands

    VehicleTypes = {
        mechanic = { 'towtruck', 'towtruck2' },
        tow      = { 'flatbed', 'flatbed2', 'flatbed3' },
        service  = { 'towtruck', 'towtruck2' },
    },

    DeliveryLocations = {
        workshop_ls = { name = "LS Customs", coords = vector3(-370.6018, -108.1824, 38.6807), heading = 162.9936 },
    },

    Clients = { "Michael Thompson", "David Garcia", "Sarah Jenkins" },

    Locations = {
        { name = "Cypress Flats", coords = vector3(725.2015, -2033.3895, 29.2840), heading = 354.6791 },
    },
}
```

### Adding your own fault type

Every entry in `Config.Tasks.IssueTypes` describes what is broken on the vehicle and the steps needed to fix it. `targetBone` decides where the employee has to stand, and `action` decides what the step actually repairs.

```lua
Config.Tasks.IssueTypes = {
    ["Engine overheating"] = {
        damage = { engineHealth = 200.0, popTires = false },
        effects = {},
        steps = {
            { targetBone = "engine", labelKey = "tasksOpenHood",     action = "open_hood",     duration = 2000 },
            { targetBone = "engine", labelKey = "tasksRepairEngine", action = "repair_engine", duration = 10000,
              animDict = "mini@repair", animName = "fixing_a_ped" },
            { targetBone = "engine", labelKey = "tasksCloseHood",    action = "close_hood",    duration = 2000 }
        }
    },
    ["Flat tire"] = {
        damage = { engineHealth = 1000.0, popTires = true, tiresToPop = { 0, 1 } },
        effects = {},
        steps = {
            { targetBone = "wheel_lf", labelKey = "tasksInspectTire", action = "inspect",     duration = 3000 },
            { targetBone = "wheel_lf", labelKey = "tasksReplaceTire", action = "repair_tire", duration = 8000 }
        }
    },
}
```

`labelKey` is a translation key — add it to `config/translations/*.lua` if you introduce a new one, otherwise the raw key is displayed.

## Dispatch

```lua
Config.Dispatch = {
    IgnoredJobs = { ... },      -- jobs whose alerts the tablet ignores
    Units = { ... },            -- unit callsigns available to employees
    ShowOnScreenAlerts = true,  -- set false if an external dispatch already draws alerts

    Integration = {
        rcore_dispatch = false,
        core_dispatch = false,
        opto_dispatch = false,
        tk_dispatch = false,
        _0r_dispatch = false,
        frkn_police_dispatch = false,
    },

    DeduplicationDistance = 20.0,
    AlertHistoryDuration = 600000, -- ms an alert stays in the history and on the map
}
```

### Calls

Everything below lives under `Config.Dispatch` in `config/config.lua`. Every option falls back to a default, so a config copied from an older version still runs.

### Job life cycle

A job moves `new → accepted → on scene → closed`, and closing asks for a reason that stays in the archive. The card lists who took it and with which unit.

```lua
Lifecycle = {
    enabled = true,
    requireCloseReason = true,
    onlyAssignedCanClose = true,
    autoCloseAfter = 3600,   -- seconds of silence before an accepted job closes itself, 0 = never

    CloseReasons = { 'repaired', 'towed', 'refused', 'noShow', 'unfounded', 'duplicate' },
},
```

Reason labels come from the translations (`dispatchCloseReason<Name>`); a reason without a key shows its raw name.

### Priorities

One priority drives the chip colour, the list order, the blip size on the map and the sound. A broken car is not a life-threatening emergency, so the tablet ships `low`, `medium` and `high` without `critical`; add it back if your workshop runs roadside rescue. `DefaultPriority = 'medium'` is used for alerts that arrive without one.

```lua
Priorities = {
    ['low']    = { weight = 1, color = { 34, 197, 94 },  sound = 'alert.mp3', repeatSound = 1, volumeScale = 0.6, blipScale = 0.8 },
    ['medium'] = { weight = 2, color = { 234, 179, 8 },  sound = 'alert.mp3', repeatSound = 1, volumeScale = 0.8, blipScale = 0.9 },
    ['high']   = { weight = 3, color = { 249, 115, 22 }, sound = 'alert.mp3', repeatSound = 1, volumeScale = 1.0, blipScale = 1.1 },
    -- ...
},
```

`Emphasis` gives the alert types on its list the loudest treatment: a red frame on screen, a larger pin on the map and a marked card. It is off by default on the mechanic tablet (`Emphasis.enabled = false`).

### Creating a job from the tablet

```lua
CreateCall = {
    enabled = true,
    defaultPriority = 'medium',
    cooldown = 10000,      -- ms between two jobs from the same worker
    allowedGrades = {},    -- empty = anyone with a job from Config.Jobs
    allowMapPick = true,   -- pick the location on the live map
    Icons = { ... },
},
```

Grade limits are checked on the server as well, not only by hiding the button.

### Callers, archive and quick keys

```lua
Calls = {
    callerInfo = true,       -- show who called (stripped on the server when false)
    allowAnonymous = false,
    attachments = true,      -- a photo on a call, https only
    attachmentHosts = {},    -- empty = any host
},

History = {
    enabled = true,
    keepDays = 30,           -- archived jobs older than this are deleted, 0 = keep forever
    pageSize = 25,
    defaultSort = 'newest',
},

QuickActions = {
    enabled = true,
    accept  = { enabled = true, key = 'Z' },
    dismiss = { enabled = true, key = 'O' },   -- hides it for you only
    expand  = { enabled = true, key = 'J' },
},

SidebarBadge = {
    enabled = true,
    count = 'new',  -- 'new' = nobody took it yet, 'active' = every open job
},
```

Closed jobs are archived in the database (created automatically) and can be searched by title, code and street, filtered by priority and reason. Quick keys act on the newest on-screen alert without opening the tablet.

### Worker commands

```lua
OfficerCommands = {
    enabled = true,

    panic = {
        enabled = false,           -- off by default, see below
        command = 'mechpanic',
        key = '',
        code = '10-13',
        priority = 'high',
        alertType = 'WorkerPanic',
        cooldown = 30,
    },

    location = {
        enabled = true,
        command = 'mechlocation',
        key = '',                  -- e.g. 'F10' to bind it
        code = '10-20',
        priority = 'low',
        alertType = 'WorkerLocation',
        cooldown = 20,
    },

    maxNoteLength = 128,
},
```

Both take an optional note. Name, badge and position are read on the server. The panic button ships disabled: a workshop is not an emergency service, so turn it on only if your crew does roadside recovery where it matters.

### Civilian line — `/913`

```lua
CitizenCalls = {
    enabled = true,
    minLength = 4,
    maxLength = 200,
    anonymousKeyword = 'anon',

    Lines = {
        {
            enabled = true,
            command = '913',            -- /913 <what happened>
            code = '913',
            priority = 'medium',
            icon = 'fa-truck-pickup',
            alertType = 'CitizenCall',

            targetJob = nil,             -- nil = every job board sees it
            forwardTo = {},              -- other QF tablets that get a copy, e.g. { 'qf_mdt_police_v2' }

            cooldown = 120,              -- seconds between two calls from the same person
            maxPerSession = 0,
            duplicateWindow = 600,
            nearbyRadius = 60.0,         -- calls close together count as one event
            nearbyWindow = 90,

            anonymous = false,
            allowAnonymousFlag = false,
            blockedJobs = {},
        },
    },
},

SiblingMDTs = { 'qf_mdt_police_v2', 'qf_mdt_ambulance_v2', 'qf_mdt_doj_v2' },
```

Every entry in `Lines` is a separate command with its own code, priority and anti-spam counters. `forwardTo` sends a copy to other QF tablets, so one number can dispatch two services at once. A workshop bills the caller, so anonymous calls are off (`allowAnonymous = false`, `allowAnonymousFlag = false`).

{% hint style="warning" %}
One command belongs to exactly one tablet. The QF tablets use `/911` police, `/912` ambulance, `/913` mechanic and `/914` DOJ. The tablets listed in `SiblingMDTs` are checked on start and a command registered twice is printed in the server console. If your phone already provides the number, turn the line off and connect the phone to `CreateCitizenCall`.
{% endhint %}

## Interface

```lua
Config.NUI = {
    fractionName = "LSC",
    fractionFullName = "Los Santos Customs",
    title = "MDT LSC",
    primaryColor = ParseRGB({ 231, 149, 74 }),
    showLicenses = true,
    enableRadar = true,
    enableBodycam = true,
    enableBadge = true,

    -- Every page can be hidden by setting show = false
    sidebarPages = {
        home    = { icon = "fa-house",  show = true },
        tasks   = { icon = "fa-wrench", show = true },
        map     = { icon = "fa-map",    show = true },
        -- ...
    },
}
```

Other useful options:

| Option                             | Description                                                                |
| ---------------------------------- | -------------------------------------------------------------------------- |
| `Config.UseFrameworkNotifications` | Route notifications through your framework instead of the built-in ones.   |
| `Config.Mugshot`                   | `autoTake` and `uploadType` (`localfiles` or `fivemanage`).                |
| `Config.CitizenLicenses`           | Which licenses employees may view, grant and revoke, and from which grade. |
| `Config.Vehicles` / `Config.Map`   | Workshop locations and the vehicle classes tracked on the live map.        |
| `Config.UsableItems`               | Items that open the tablet from the inventory.                             |
| `Config.SSN`                       | Which database column is used as the citizen identifier.                   |
| `Config.Customization`             | Additional cosmetic tweaks of the interface.                               |
| `Config.Debug`                     | Debug prints in the server console.                                        |

## Running several tablets side by side (`Config.Base`)

Every module stores its data in its own MySQL table, named after the resource (`qf_mdt_mechanic_v2_*`). `Config.Base` lets you point any module at a different table, so a second workshop tablet can share selected data — the client records or the price list, for example — while keeping its own employees, announcements and radio codes.

```lua
Config.Base = {
    -- fines       = "qf_mdt_mechanic_v2_fines",
    -- tags        = "qf_mdt_mechanic_v2_tags",
    -- entityNotes = "qf_mdt_mechanic_v2_entity_notes",
    -- mugshots    = "qf_mdt_mechanic_v2_mugshots",
}
```

{% hint style="warning" %}
Anything you leave out keeps its own default table, so that data stays private to the company. When a table **is** shared, every tablet pointing at it must use the same value, and related tables (cases, evidences, warrants and their officer/citizen tables) have to be shared together.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://wiki.qfdevelopers.com/scripts/editor-22/configuration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
