> 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/additional-informations.md).

# Additional Informations

Page dedicated to Additional Informations about our Mechanic MDT \[V2].

#### Core Features

* **Universal Framework Support:** Works with ESX, QBCore and QBox.
* **Repair Jobs:** Generated jobs around the map with per-fault repair steps, client peds, tow integration and automatic payouts.
* **Client & Vehicle Records:** Searchable citizens and vehicles with notes, tags, mugshots and license overview.
* **Invoicing:** Configurable price list, per-grade limits and bridges into most popular billing and banking resources.
* **Dispatch & Live Map:** Jobs with a full life cycle, an archive, quick keys, `/mechlocation` and the civilian line `/913`, plus a live map of workshops and vehicles.
* **Several Workshops:** LS Customs, Benny's and others on one tablet, each with its own ranks, colours and society.
* **Banking V2 Billing:** Optional price list and invoices through our Banking \[V2].

***

#### Developer API (Exports & Events)

{% tabs %}
{% tab title="Server Exports" %}
**AddLog**

Adds an entry to the Audit Log — useful for logging tool usage, parts withdrawal or boss menu actions from other resources.

**Syntax:**

```lua
exports.qf_mdt_mechanic_v2:AddLog(source, tag, text, color, fields, args)
```

| Parameter | Type   | Description                                                     |
| --------- | ------ | --------------------------------------------------------------- |
| `source`  | number | Player source ID. `nil` is logged as "System".                  |
| `tag`     | string | Category tag (e.g. 'parts', 'tasks', 'boss').                   |
| `text`    | string | Log message.                                                    |
| `color`   | string | Color theme: `blue`, `red`, `green`, `orange`, `black`.         |
| `fields`  | table  | (Optional) Key-value pairs with extra metadata.                 |
| `args`    | table  | (Optional) Arguments for translation if `text` is a locale key. |

```lua
exports.qf_mdt_mechanic_v2:AddLog(
    source,
    "parts",
    "Withdrew parts from the workshop stock",
    "orange",
    {
        part = "Turbocharger",
        amount = 1,
        vehicle = "ABC 123"
    }
)
```

#### `CreateCall`

Raises a call on the dispatch board from another resource. Everything except the title and the coordinates is optional.

```lua
local id = exports.qf_mdt_mechanic_v2:CreateCall({
    title       = 'Vehicle broken down',
    coords      = vector3(425.1, -979.5, 30.7),
    code        = '10-50',
    description = 'Car stalled on the highway, driver waiting',
    priority    = 'high',
    icon        = 'fa-truck-pickup',
    job         = 'mechanic',     -- only this job sees it, with Config.PerJobData.dispatch = true
})
```

Returns the id of the call, or `nil` when a free zone or the deduplication window dropped it.

#### `CreateCitizenCall`

Raises a call on behalf of a player who has no tablet, for example from a phone app. Coordinates default to the player's position. To show the caller's phone number, add `EDITABLE.GetPhoneNumber(xPlayer)` returning it to `config/server/editable.lua` (the same function as in the Police MDT \[V2]); it is not asked for anonymous calls.

```lua
exports.qf_mdt_mechanic_v2:CreateCitizenCall(playerSource, {
    title       = 'Emergency call',
    description = 'Car stalled on the highway, driver waiting',
    priority    = 'high',
    anonymous   = false,
})
```

#### `CloseCall`

Closes an active call and writes it to the archive.

```lua
exports.qf_mdt_mechanic_v2:CloseCall(id, 'repaired')
```

**Other server exports**

| Export                                                               | Description                                                                    |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| `GetOfficerBadge(identifier)` / `SetOfficerBadge(identifier, badge)` | Reads or sets an employee's badge number.                                      |
| `GetOfficerHours(identifier)`                                        | Hours on duty.                                                                 |
| `RefreshOfficer(identifier)`                                         | Rereads badge, grade and radio of an online employee.                          |
| `GetFineCatalogue()`                                                 | The price list, read by Banking V2 when the tablet is first switched on there. |
| {% endtab %}                                                         |                                                                                |

{% tab title="Client Exports" %}
**CreateDispatchAlert**

Sends a dispatch alert to every employee on duty.

```lua
exports.qf_mdt_mechanic_v2:CreateDispatchAlert(coords, title, description, code, colorRGB, maxUnits, duration)
```

| Parameter     | Type    | Description                                      |
| ------------- | ------- | ------------------------------------------------ |
| `coords`      | vector3 | Location of the alert.                           |
| `title`       | string  | Alert header.                                    |
| `description` | string  | Detailed info, e.g. street name and vehicle.     |
| `code`        | string  | Dispatch code.                                   |
| `colorRGB`    | table   | `{r, g, b}` format.                              |
| `maxUnits`    | number  | (Optional) How many units may attach.            |
| `duration`    | number  | (Optional) Time in ms the alert stays on screen. |

```lua
local coords = GetEntityCoords(PlayerPedId())

exports.qf_mdt_mechanic_v2:CreateDispatchAlert(
    coords,
    "Vehicle Recovery Requested",
    "Broken down vehicle blocking the highway.",
    "10-50",
    { 231, 149, 74 },
    4,
    10000
)
```

**Badge & Bodycam**

```lua
exports.qf_mdt_mechanic_v2:showOfficerBadge({
    name = "Robert Smith",
    badge = "LSC-14",
    gradeLabel = "Leader",
    mugshot = "https://example.com/photo.png", -- optional
    licenses = {
        { label = "Heavy Vehicle", active = true },
        { label = "Tuning Certificate", active = false }
    }
})

exports.qf_mdt_mechanic_v2:showBodycam()
exports.qf_mdt_mechanic_v2:hideBodycam()
exports.qf_mdt_mechanic_v2:toggleBodycam()
```

**Other exports**

| Export                               | Description                                                                 |
| ------------------------------------ | --------------------------------------------------------------------------- |
| `GetMugShotBase64(ped, transparent)` | Renders a mugshot of the ped and returns it as a base64 string.             |
| `showDispatchAlert(data)`            | Draws a dispatch alert on screen without going through the dispatch system. |
| `updateReactions(data)`              | Updates the unit reactions shown on an alert that is already on screen.     |
| {% endtab %}                         |                                                                             |

{% tab title="Editable Hooks" %}
`config/server/editable.lua` and `config/client/editable.lua` hold the functions that talk to the rest of your server. They are plain Lua and meant to be edited — this is where you adapt the tablet to a custom licence system, a custom billing resource or your own name lookup.

Frequently changed hooks:

| Hook                                          | Purpose                                                        |
| --------------------------------------------- | -------------------------------------------------------------- |
| `EDITABLE.GetBadge(xPlayer)`                  | Badge number shown on the employee badge.                      |
| `EDITABLE.GetName(identifier)`                | How a citizen's name is resolved from your database.           |
| `EDITABLE.GetPlayerLicenses(identifier)`      | Where licenses are read from.                                  |
| `EDITABLE.GiveLicense` / `RevokeLicense`      | How licenses are granted and revoked.                          |
| `EDITABLE.GetPlayerVehicles(identifier)`      | Vehicle lookup for the records page.                           |
| `EDITABLE.GetVehicleModel(source, modelID)`   | Turning a model hash into a readable name.                     |
| `EDITABLE.ChargePlayer(source, amount, why)`  | How a client is charged for an invoice.                        |
| `EDITABLE.AddMoneyToSociety(amount, jobName)` | Where the company share of an invoice goes.                    |
| `EDITABLE.CreateBilling(...)`                 | Bridge into your billing resource.                             |
| `EDITABLE.TakeMugshot(playerId)`              | Mugshot capture.                                               |
| `EDITABLE.OnStatusChange(source, status)`     | Fired when an employee goes available/unavailable — see below. |
| `EDITABLE.CanOpenMDT()` (client)              | Extra conditions before the tablet may open.                   |

**Duty status hook**

```lua
function EDITABLE.OnStatusChange(source, status)
    -- status: "available" or "unavailable"

    if status == "available" then
        TriggerEvent('examplemechanicjob:onDuty', source)
    elseif status == "unavailable" then
        TriggerEvent('examplemechanicjob:offDuty', source)
    end
end
```

{% endtab %}
{% endtabs %}

***

#### Frequently Asked Questions (Q\&A)

**Q: The tablet does not open at all.**\
A: Check that the player's job matches `Config.Jobs` and that their grade exists in `Config.Grades`. `Config.Debug = true` prints the resolved job and grade to the server console.

**Q: Repair jobs never appear on the Tasks page.**\
A: Jobs are generated on an interval — `Config.Tasks.RefreshInterval` — up to `MaxAvailableJobs` at a time. Right after a restart the first batch takes one interval to appear.

**Q: Recovery jobs should use my tow script instead.**\
A: Set the matching entry in `Config.Tasks.CustomTowScript`, e.g. `jo_towtruck = true`. The tablet then hands the vehicle over instead of running its own recovery logic.

**Q: Invoices do not show up in my billing resource.**\
A: Enable exactly one entry in `Config.Billings`. If your resource is not listed, implement `EDITABLE.CreateBilling` in `config/server/editable.lua` instead.

**Q: Alerts appear twice on screen.**\
A: An external dispatch is drawing them as well. Set `Config.Dispatch.ShowOnScreenAlerts = false`.


---

# 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/additional-informations.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.
