> 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-1/configuration.md).

# Configuration

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

Everything below lives in `config/config.lua`, which stays open after escrow. The file is split into the same sections as this page. After changing it, restart the resource and run `/mdt doctor` to check the result.

## Languages

The default language of the tablet is set in `Config.NUI.defaultLangCode`. Every player can switch it in the tablet's own settings.

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

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

The translation files are in `config/translations/` and stay editable after escrow.

### Commands & Keybinds

Every key is a FiveM key binding, so players can change it under Settings > Key Bindings > FiveM. An empty key registers the binding unassigned.

**General**

* `/qf_mdt_doj_v2` (DELETE): Open the tablet.
* `/qf_mdt_doj_v2badge` (B): Show your court ID to the people around you.
* `/docsettings`: Set where shown documents appear on your screen, with scale and opacity.

**Requests board**

* `/qf_mdt_doj_v2_alert_accept` (Z): Accept the latest request on screen.
* `/qf_mdt_doj_v2_alert_dismiss` (O): Dismiss the latest request on screen.
* `/qf_mdt_doj_v2_alert_expand` (J): Expand the latest request on screen.
* `/qf_mdt_doj_v2_alert_gps` (unassigned): Set the GPS to the latest request.
* `/qf_mdt_doj_v2_dispatch` (unassigned): Open the tablet straight on the requests board.
* `/dojlocation`: Staff report their position to colleagues.

**Citizens**

* `/914 <text>`: Ask for counsel.
* `/papers`: Ask the nearest player to show a document (court staff and the jobs in `Config.Identity.inspect.jobs`).

**Camera Mode**

* `/qf_mdt_doj_v2_blocknuifocus` (L-ALT): Free the cursor while using the tablet camera.
* `/qf_mdt_doj_v2_capturephoto` (ENTER): Take the photo.

**Admin**

* `/mdt doctor`: Configuration check. Needs the `qf_mdt_doj_v2.doctor` ace.
* `/identity issue | revoke | check | points`: Identity document tools for the console or an admin. Needs the `qf_mdt_doj_v2.identity` ace.

{% hint style="info" %}
Both the keys and the command names come from `Config.ToggleMDT`, `Config.Badge.show`, `Config.Camera`, `Config.Dispatch` and `Config.Identity` in `config/config.lua`. The names above are the defaults.
{% endhint %}

***

## General

```lua
Config.Debug = false                    -- extra console output, keep it off on a live server
Config.UseFrameworkNotifications = false -- true routes notifications through your framework
Config.ServerCallbackTimeout = 15000    -- ms the tablet waits for the server
Config.SSN = 'id'                       -- ESX only: users column used as the citizen number

Config.Doctor = {
    enabled = true,
    command = "mdt",                    -- /mdt doctor
    ace = "qf_mdt_doj_v2.doctor",
}
```

`Config.Frameworks` detects ESX, QBCore and QBox on start. Change it only if your framework runs under another resource name.

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

Every module stores its data in its own table named after the resource (`qf_mdt_doj_v2_*`). `Config.Base` lets you point a module at another table, so a second courthouse tablet can share selected data while keeping its own staff, announcements and logs.

```lua
Config.Base = {
    -- Citizen record
    -- mugshots    = "qf_mdt_doj_v2_mugshots",
    -- fines       = "qf_mdt_doj_v2_fines",
    -- tags        = "qf_mdt_doj_v2_tags",
    -- entityNotes = "qf_mdt_doj_v2_entity_notes",

    -- Docket. Share these together with 'cases'.
    -- cases       = "qf_mdt_doj_v2_cases",
    -- ...
}
```

{% hint style="warning" %}
Anything you leave commented out keeps its own default table. When a table **is** shared, every tablet pointing at it must use the same name, and the docket tables (cases, parties, charges, notes, evidence, verdicts, hearings, warrants, documents) have to be shared together. Identity documents are never shared.
{% endhint %}

***

## Jobs & Permissions

`Config.Jobs` decides which framework jobs may open the tablet. With a single job set to `true` the tablet uses the settings of this file.

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

Config.Grades = {
    { id = 0, name = "Intern" },
    { id = 1, name = "Clerk" },
    { id = 2, name = "Attorney" },
    { id = 3, name = "Senior Attorney" },
    { id = 4, name = "Judge" }
}
```

The `id` values **must** match the grade numbers of the job in your framework.

### Several offices on one tablet

Give a job a table instead of `true` to make it a separate office with its own name, colour, ranks, society account and court ID look. A typical setup is the bench, the prosecution and the defence:

```lua
Config.Jobs = {
    ['doj'] = { primary = true },
    ['prokurator'] = {
        fractionName     = "DA",
        fractionFullName = "District Attorney's Office",
        title            = "MDT DA",
        color            = { 180, 60, 60 },
        society          = { name = "society_da", jobname = "prokurator", label = "DA" },
        sharedWith       = { 'doj' },
        logo             = "da.webp",
        badge            = { layout = "portrait" },
        letterhead       = { logo = "da.webp", seal = "da-seal.webp", city = "Paleto Bay" },
        grades           = {
            { id = 0, name = "Intern" },
            { id = 1, name = "Attorney", badgeTitle = "Deputy District Attorney" },
            { id = 2, name = "District Attorney" },
        },
    },
}
```

| Field                                  | Description                                                                       |
| -------------------------------------- | --------------------------------------------------------------------------------- |
| `primary`                              | The main office. Set it on exactly one job.                                       |
| `enabled`                              | `false` removes access without deleting the entry.                                |
| `fractionName` / `fractionFullName`    | Short name in the sidebar and full name on the court ID.                          |
| `title`                                | Tablet title under the short name.                                                |
| `color` / `primaryColor`               | Accent as `{ r, g, b }`, or as HSL when it has to differ.                         |
| `logo`                                 | Office emblem: a file in `artwork/` or an https address.                          |
| `badge`                                | Own court ID look, any field of `Config.Badge.template`.                          |
| `letterhead`                           | Heading of this office's papers: `{ name, logo, seal, city }`.                    |
| `grades`                               | Own ranks. A rank may add `badgeTitle`, printed above the name on its court ID.   |
| `requiredGrades`                       | Own permission thresholds over `Config.NUI.requiredGrades`.                       |
| `society`, `officers`, `billingLimits` | Own versions of the global options of the same name.                              |
| `stations`                             | Own buildings on the map, same shape as `Config.Map.Courthouses`.                 |
| `sharedWith`                           | Other jobs this one sees in the staff list, on the map and on the requests board. |

`Config.PerJobData` decides which modules keep separate data per office (announcements, radio codes, gallery, audit log, requests board). Cases, warrants, verdicts and hearings are always shared.

### Staff management

```lua
Config.Officers = {
    fireJob = "unemployed",     -- job given to a dismissed official
    fireGrade = 0,
    KickFromDutyJob = {         -- optional off-duty job
        enabled = false,
        name = "offdoj"
    }
}

Config.Customization = {
    vBadges = false, -- badge numbers kept in users.badge (ESX) or callsign metadata (QBCore/QBox)
    vHours = false,  -- another resource counts worked hours
    vManage = false, -- another resource hires, dismisses and promotes
}
```

### Permissions per action

`Config.NUI.requiredGrades` sets the lowest grade for every action in the tablet. Every check is made on the server, not only hidden in the interface.

```lua
requiredGrades = {
    docket    = { create = 1, update = 2, delete = 4, assignRole = 3, changeStatus = 2, addNote = 1, manageCharges = 2 },
    penalCode = { view = 0, create = 4, update = 4, delete = 4 },
    warrants  = { request = 1, review = 4, delete = 4 },
    verdicts  = { issue = 4, delete = 4 },
    documents = { revoke = 4, template = 1, copy = 1 },
    identity  = { review = 1, issue = 1, report = 1, revoke = 4, points = 4 },
    evidence  = { add = 2, decide = 4, delete = 4 },
    hearings  = { create = 2, update = 2, delete = 3 },
    officers  = { hire = 4, fire = 4, resetHours = 4, kickFromDuty = 3, update = 4, reportCourtId = 3, issueCourtId = 4 },
    -- citizens, annoucements, radioCodes, dispatch ...
}
```

With the default ladder this means:

| Grade | Name            | Can typically                                                                 |
| ----- | --------------- | ----------------------------------------------------------------------------- |
| 0     | Intern          | read the docket and the penal code                                            |
| 1     | Clerk           | open cases, add notes, request warrants                                       |
| 2     | Attorney        | manage charges, change case status, schedule hearings                         |
| 3     | Senior Attorney | assign roles, post court notices, manage radio codes                          |
| 4     | Judge           | decide warrants, deliver and vacate verdicts, manage staff and the penal code |

***

## Tablet & Interface

```lua
Config.ToggleMDT = { key = 'DELETE', commandName = 'qf_mdt_doj_v2', keymappingLabel = 'Open tablet [DOJ]' }

Config.UsableItems = {
    enabled = true,
    mdt   = { enabled = true, itemName = "qf_mdt_doj_v2" },       -- opens the tablet
    badge = { enabled = true, itemName = "qf_mdt_doj_v2_badge" }, -- shows the court ID
}

Config.Tablet = {
    model = "prop_cs_tablet",
    animDict = "amb@world_human_seat_wall_tablet@female@base",
    animName = "base",
}

Config.NUI = {
    fractionName = "DOJ",
    fractionFullName = "Department of Justice",
    title = "MDT DOJ",
    primaryColor = ParseRGB({ 37, 167, 150 }),
    showLicenses = true,
    enableBadge = true,

    -- Every page can be hidden by setting show = false
    sidebarPages = {
        home      = { icon = "fa-house",          show = true },
        cases     = { icon = "fa-gavel",          show = true },
        warrants  = { icon = "fa-file-signature", show = true },
        hearings  = { icon = "fa-calendar-days",  show = true },
        identity  = { icon = "fa-address-card",   show = true },
        radioCodes = { icon = "fa-walkie-talkie", show = false },
        -- ...
    },
}
```

Other useful options:

| Option                       | Description                                                                                     |
| ---------------------------- | ----------------------------------------------------------------------------------------------- |
| `Config.Mugshot`             | `autoTake`, `size` and `uploadType` (`localfiles` or `fivemanage`).                             |
| `Config.Limits`              | Longest text accepted for notes, case descriptions, verdicts and photos, checked on the server. |
| `Config.Basics.primaryColor` | Accent used when neither the office nor `Config.NUI` sets one.                                  |
| `Config.Camera`              | Keys of the in-game camera used for gallery photos.                                             |

{% hint style="info" %}
For `uploadType = "fivemanage"` put the key in `server.cfg`, not in the config: `set qf_mdt_mugshot_fivemanage_api_key "your key"`.
{% endhint %}

***

## Money

```lua
Config.Society = {
    name = "society_doj",
    jobname = "doj",
    label = "DOJ",
    percentToBoss = 0.80,   -- share of a fee that goes to the court account
    percentToWorker = 0.20, -- share that goes to the official who issued it
}
```

Fines paid at the e-office and identity document fees are paid into this account. Only the primary office uses `Config.Society`; any other office pays into `society_<job>` unless it sets its own `society`.

`Config.Billings` and `Config.Banks` list the supported billing and banking resources. Turn on at most one entry in `Config.Billings` to send fees from the citizen file through your billing resource. With all of them off, the amount is taken from the citizen's bank and paid into `Config.Society`.

### Court fees

`Config.FineList` holds the court fees and honoraria charged from the citizen file. Criminal fines come from the penal code through a verdict, not from this list.

```lua
Config.FineList = {
    {
        id = "1",
        label = "Court Fees",
        items = {
            { id = "1", label = "Case Filing Fee",   fine = 750 },
            { id = "3", label = "Appeal Filing Fee", fine = 2500 },
            { id = "8", label = "Contempt of Court", fine = 5000 },
        }
    },
    {
        id = "2",
        label = "Legal Representation",
        items = {
            { id = "9",  label = "Consultation", fine = 1500 },
            { id = "10", label = "Retainer",     fine = 10000 },
        }
    }
}
```

`Config.BillingLimits` sets how close the citizen must be, the cooldown between two fees and the highest total per grade.

***

## Items & Showing

```lua
-- "auto" picks the first one running: ox_inventory, qs-inventory, tgiann-inventory,
-- codem-inventory, ps-inventory, qb-inventory. "none" keeps documents in the tablet only.
Config.Inventory = "auto"

Config.Showing = {
    lineOfSight = true,   -- only people who can see you get the document on screen
    maxRadius = 20.0,     -- upper limit for every showing radius
    cooldown = 8,
    placementCommand = 'docsettings',
}
```

### Court ID (`Config.Badge`)

```lua
Config.Badge = {
    enabled = true,
    radius = 5.0,       -- how far showing the card reaches, in metres
    cooldown = 2,
    duration = 5000,

    template = {
        layout = "landscape",  -- or "portrait"
        accent = "",           -- "H S% L%", empty takes the office colour
        logo = "",
        background = "",       -- a file in artwork/ or an https address
        fields = { "photo", "badge", "grade", "issued" },
    },

    item = {
        mode = "owner",        -- "owner": one card with a serial per official, "holder": shows whoever uses it
        serialPrefix = "CID",
        takeBack = false,      -- remove the item when its card is closed
    },

    issue = "portal",          -- "portal": apply and collect at the e-office, "auto": handed over when hired

    -- Other services that carry a card without getting the tablet.
    offices = {
        police    = { label = "Los Santos Police Department", issueGrade = 3, offDutyJob = "offpolice",    itemName = "qf_mdt_doj_v2_badge_police" },
        ambulance = { label = "Emergency Medical Services",   issueGrade = 3, offDutyJob = "offambulance", itemName = "qf_mdt_doj_v2_badge_ambulance" },
    },
}
```

{% hint style="info" %}
Office logos and card backgrounds go into the `artwork/` folder next to `fxmanifest.lua`. Drop the file in, name it in the config without the folder (`"da.webp"`) and restart the resource. Nothing has to be rebuilt.
{% endhint %}

***

## Citizen File

`Config.Licenses` picks where licences are stored (`esx_license`, `qb_license`, `bcs_license` or `cs_license`). `Config.CitizenLicenses` lists the licences shown in the citizen file and the grades that may grant or revoke them.

```lua
Config.Licenses = { bcs_license = false, esx_license = true, cs_license = false, qb_license = false }

Config.CitizenLicenses = {
    { name = 'drive',  symbol = '', icon = 'fa-regular fa-car', manageable = true, giveMinGrade = 4, revokeMinGrade = 4 },
    { name = 'weapon', symbol = '', icon = 'fa-regular fa-gun', manageable = true, giveMinGrade = 4, revokeMinGrade = 4 },
}
```

{% hint style="warning" %}
With the identity module on, a licence granted by a document (for example the driving licence) is changed only on that document. Its switch in the citizen file shows a lock and leads to the document.
{% endhint %}

***

## Court

### Cases (`Config.Docket`)

```lua
Config.Docket = {
    signaturePattern = "{type}-{year}/{seq}", -- CR-2026/0001
    signatureSequencePadding = 4,

    statuses = {
        { name = "filed",     labelKey = "docketStatusFiled",     color = ParseRGB({ 148, 163, 184 }) },
        { name = "closed",    labelKey = "docketStatusClosed",    color = ParseRGB({ 34, 197, 94 }),   closing = true },
        { name = "dismissed", labelKey = "docketStatusDismissed", color = ParseRGB({ 100, 116, 139 }), closing = true },
        -- ...
    },

    types = {
        { name = "criminal", code = "CR", labelKey = "docketTypeCriminal" },
        { name = "civil",    code = "CV", labelKey = "docketTypeCivil" },
        { name = "traffic",  code = "TR", labelKey = "docketTypeTraffic" },
        { name = "appeal",   code = "AP", labelKey = "docketTypeAppeal" },
    },

    roles = {
        { name = "prosecutor", labelKey = "docketRoleProsecutor" },
        { name = "defender",   labelKey = "docketRoleDefender" },
        { name = "judge",      labelKey = "docketRoleJudge" },
    },
}
```

A status with `closing = true` counts as finished: the case drops out of the default filter and can no longer get a verdict.

### Penal code (`Config.PenalCode`)

The seed is imported **once**, into an empty table on the first start. After that the penal code is edited in the tablet and changes in the config have no effect.

```lua
Config.PenalCode = {
    reseedOnStart = false,

    categories = {
        { name = "felony",      labelKey = "penalCategoryFelony" },
        { name = "misdemeanor", labelKey = "penalCategoryMisdemeanor" },
        { name = "infraction",  labelKey = "penalCategoryInfraction" },
        { name = "traffic",     labelKey = "penalCategoryTraffic" },
    },

    -- fine and jail are { min, max }, jail in months
    seed = {
        { code = "P-101", name = "Murder",        category = "felony",      fine = { 25000, 75000 }, jail = { 60, 240 } },
        { code = "P-201", name = "Assault",       category = "misdemeanor", fine = { 2000, 6000 },   jail = { 3, 18 } },
        { code = "P-401", name = "Speeding",      category = "traffic",     fine = { 300, 1500 },    jail = { 0, 0 } },
    }
}
```

{% hint style="warning" %}
`reseedOnStart = true` wipes the table and imports the seed again on **every** start. Use it only while you are still designing your penal code and turn it off before going live.
{% endhint %}

### Warrants, hearings and evidence

```lua
Config.Warrants = {
    types = {
        { name = "arrest",       labelKey = "warrantTypeArrest" },
        { name = "search",       labelKey = "warrantTypeSearch" },
        { name = "seizure",      labelKey = "warrantTypeSeizure" },
        { name = "surveillance", labelKey = "warrantTypeSurveillance" },
    },
    defaultValidityHours = 72,
    expiryCheckInterval = 300,
}

Config.Hearings = {
    -- A room with coords and radius counts attendance in that room.
    rooms = {
        { name = "room_a", labelKey = "hearingRoomA" },
        { name = "room_b", labelKey = "hearingRoomB", coords = vector3(241.2, -1088.9, 29.3), radius = 12.0 },
    },
    reminderMinutes = 15,     -- 0 disables the reminder for assigned staff
    noShow = {                -- a no-show can request a warrant, a judge still decides it
        requestWarrant = true,
        warrantType = "arrest",
        validityHours = 168,
    },
}

Config.Evidence = {
    maxPerCase = 20,
    labelPrefix = "D",        -- exhibits are numbered D-1, D-2...
}
```

`Config.Dashboard` sets what the first screen counts: expiring documents, upcoming hearings and stalled cases. `Config.DefaultRadioCodes` are created once on the first start and edited in the tablet afterwards.

### Court papers (`Config.Documents`)

Verdicts, approved warrants and summonses can be printed as papers with a letterhead, the judge's drawn signature and a code anyone can check in the tablet.

```lua
Config.Documents = {
    enabled = true,

    -- Letterhead. An office sets its own in Config.Jobs[job].letterhead.
    court = "",
    city = "Los Santos",
    logo = "",
    seal = "",

    requireSignature = true,   -- the official must draw a signature in Settings first

    items = {
        enabled = true,
        removeOnRevoke = false,
        verdict  = "qf_mdt_doj_v2_verdict",
        warrant  = "qf_mdt_doj_v2_warrant",
        summons  = "qf_mdt_doj_v2_summons",
        template = "qf_mdt_doj_v2_court_paper",
    },

    copies = { enabled = true, tablet = true, portal = true, fee = 50, cooldown = 5 },
}
```

### Papers from templates

`Config.Documents.templates` lists papers officials write by hand. Five ship with the script: court order, criminal record certificate, power of attorney, witness summons and bail order. Add your own with a key, a name and fields:

```lua
character_reference = {
    label = "Character Reference",
    icon = "fa-user-check",
    issuers = { adwokat = 1 },        -- or minGrade = 2 for every office
    case = "optional",                -- "none", "optional", "required"
    validDays = 60,                   -- or validUntil = "<a date field key>"
    subject = { label = "About" },
    fields = {
        { key = "author", type = "person", label = "Written by", required = true },
        { key = "text",   type = "text",   label = "Reference",  required = true, multiline = true },
    },
},
```

Field types are `text` (`multiline`, `max`), `date` (`time`), `person` (from the citizen register) and `amount` (`max`). `builder = "criminal_record"` prints the convictions that stand, read by the server from the court register. A broken entry is left out and `/mdt doctor` names the field to fix.

***

## Citizen E-Office (`Config.Portal`)

A clerk at the courthouse counter where players without the DOJ job read their own papers, cases and hearing dates, pay their fines and ask for counsel.

```lua
Config.Portal = {
    enabled = true,
    spawnPeds = true,   -- false: open it from your own interaction with exports.qf_mdt_doj_v2:openCitizenPortal()

    locations = {
        {
            label = "Los Santos Courthouse",
            coords = vector4(-534.3737, -166.6419, 38.3247, 37.1337),
            ped = "a_m_m_business_01",
            blip = { sprite = 419, color = 25, scale = 0.7 },
        },
    },

    interaction = { useTarget = true, icon = "fa-scale-balanced", distance = 2.0 },

    payments = {
        enabled = true,
        dueDays = 7,        -- days to pay a fine before it shows as overdue
        toSociety = true,   -- send what is paid to the court account
    },

    counsel = { enabled = true, line = "914" },
}
```

***

## Identity Documents (`Config.Identity`)

ID cards, driving licences, weapon permits and residence cards, issued by the office with a photo and a term of validity. The document grants and removes the matching framework licence.

```lua
Config.Identity = {
    enabled = true,
    authority = "",          -- empty takes Config.NUI.fractionFullName
    city = "Los Santos",
    seal = "",
    requireSignature = true,

    kinds = {
        id_card = {
            enabled = true, fee = 250, validityDays = 0, minGrade = 1,
            approval = "auto", minAge = 0, duplicateFee = 100, suspendable = false,
        },
        drive_license = {
            enabled = true, fee = 500, validityDays = 0, minGrade = 2,
            approval = "clerk", minAge = 18, requires = { "id_card" }, duplicateFee = 200,
            categories = {
                { name = "drive",       label = "B", icon = "fa-regular fa-car" },
                { name = "drive_bike",  label = "A", icon = "fa-regular fa-motorcycle" },
                { name = "drive_truck", label = "C", icon = "fa-regular fa-truck" },
            },
        },
        weapon_permit = {
            enabled = true, fee = 2500, validityDays = 90, minGrade = 4,
            approval = "clerk", minAge = 21, requires = { "id_card" }, licenses = { "weapon" },
            renewal = { enabled = true, fee = 900, windowDays = 14 },
        },
        residence_card = { enabled = false, address = true, --[[ ... ]] },
    },
}
```

| Option                 | Description                                                                                               |
| ---------------------- | --------------------------------------------------------------------------------------------------------- |
| `kinds[kind].approval` | `"clerk"` queues the application for an official, `"auto"` issues it as soon as the fee is paid.          |
| `kinds[kind].issuers`  | Offices that issue it, each with its lowest rank: `{ doj = 2, prokurator = 3 }`. Without it, `minGrade`.  |
| `kinds[kind].template` | Look of the card: `layout` (`"card"`, `"badge"` or `"paper"`), `accent` and your own `background`.        |
| `applications`         | Default approval, `pickupDays`, refunds, cooldown and appeals against a refusal.                          |
| `points`               | Penalty points from verdicts and police charges. Reaching `suspendAt` suspends the driving licence.       |
| `studio`               | The photo booth: photographer location, private routing bucket and photo validity.                        |
| `photoFallback`        | `"mugshot"` or `"none"`, used when the booth is off or `screenshot-basic` is missing.                     |
| `inspect`              | Who may ask a player for their papers (`jobs`, `commandName`) and whether they may seize them.            |
| `forgery`              | Forged papers. Off by default and needs at least one location.                                            |
| `transition`           | For servers adding the module later: until `endsAt`, current licence holders collect their card for free. |
| `items`                | Cards as inventory items, one item per document.                                                          |
| `retention`            | Days before closed applications, old documents and expired points are deleted. `0` keeps them forever.    |

### Your own documents

A hunting licence, a press card or a bar card is a new entry in `Config.Identity.kinds`. The key is the document's name in the database, so pick it once.

```lua
hunting_license = {
    label = "Hunting Licence",
    codePrefix = "HL",
    order = 5,
    icon = "fa-crosshairs",
    issuers = { doj = 2 },
    authority = "San Andreas Wildlife Service",
    fee = 800,
    validityDays = 180,
    approval = "clerk",
    minAge = 18,
    requires = { "id_card" },
    duplicateFee = 200,
    licenses = { "hunting" },
    fields = { "name", "birthDate", "sex", "permitted", "conditions" },
    template = {
        layout = "paper",
        accent = "120 40% 32%",
        permitted = "Hunting on public land during open season",
        conditions = "Carried with a valid weapon permit",
    },
},
```

Add its item under `Config.Identity.items` if documents are items on your server. Nothing has to be rebuilt: the tablet and the e-office get the list from the server.

### Putting it on your server

1. Set the photographer's desk in `Config.Identity.studio.locations[1].coords` and the spot where the picture is taken in `studio` (both `vector4`).
2. Make sure `screenshot-basic` is running, otherwise the booth does not open and cards carry the stored mugshot.
3. Put the jobs that check papers at the roadside in `Config.Identity.inspect.jobs` (default `police` and `sheriff`).
4. Decide who approves what with `approval`, `issuers` and `minGrade` of each document.
5. Optional: add the items from `ox_inventory_items.md` and turn on `Config.Identity.items`.

***

## Police MDT Bridge (`Config.PoliceBridge`)

When our Police MDT \[V2] runs on the same server, charges filed there open a case on the DOJ docket automatically. The bridge is one way and read only: it never writes to a police table and never calls a police export.

```lua
Config.PoliceBridge = {
    enabled = true,
    resourceName = "qf_mdt_police_v2",
    tables = { fines = "qf_mdt_police_v2_fines" }, -- must match the police Config.Base
    pollInterval = 60,               -- seconds between polls
    initialLookbackHours = 24,       -- a fresh install does not import years of history
    importedCaseType = "criminal",
    importedCaseStatus = "filed",
    importFineOnlyCharges = false,   -- skip pure traffic tickets without jail time

    -- Penalty points for imported charges, matched against the officer's reason.
    points = {
        enabled = false,
        rules = {
            { match = "speed",    points = 4 },
            { match = "reckless", points = 6 },
            { match = "dui",      points = 10 },
        },
        default = 0,
        max = 12,
    },
}
```

Without the police resource the bridge stays off and the tablet works on its own.

***

## 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 court tariff 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 **doj**, pick its billing faction (your court job, allowed to fine) and set the resource name to `qf_mdt_doj_v2`. On the first switch-on the bank copies the penal code 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 penal code is the bank tariff. Adding, editing and deleting offences in the tablet writes to the bank (the bank checks the faction's tariff grade); `qf_mdt_doj_v2_penal_code` is kept as a copy. Offences without a fine stay in the MDT only, and a fine range starting at 0 is stored in the bank from 1,
* court fees in the citizen file come from the rest of the bank tariff. `Config.FineList` is added to it once; custom charges are not available,
* verdict fines and fees become bank bills (`Config.Billings` is not used for them). The citizen pays a verdict fine at the e-office, where the bank takes it from their account, or at any bank. Verdicts are marked paid when the bank reports it, and bills paid or canceled while the MDT was stopped are caught up on start,
* deleting fees or vacating a verdict cancels its open bank bill. Who may do it is checked by the MDT's own grades.

{% 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 %}

## Map & Dispatch

### Live map (`Config.Map`)

```lua
Config.Map = {
    RequireGpsItem = { enabled = false, itemName = 'qf_mdt_doj_v2_gps' },

    Courthouses = {
        { id = "courthouse", name = "Los Santos Courthouse", position = { 242.6, -1379.3 }, radius = 60.0, street = "Elgin Ave" },
        { id = "city_hall",  name = "City Hall",             position = { -544.9, -204.2 }, radius = 50.0, street = "Alta St" },
    },

    Update = {
        idleUpdateInterval = 2000,  -- ms between position updates of a tablet on duty
        mainUpdateInterval = 1000,  -- ms between redraws of an open map
    },
}
```

### Requests board (`Config.Dispatch`)

The DOJ dispatch handles requests for counsel, not patrols. Citizens raise them with `/914`, staff with `/dojlocation` or from the tablet.

```lua
Config.Dispatch = {
    ShowOnScreenAlerts = true,       -- false if another resource already draws alerts

    -- new -> accepted -> on scene -> closed
    Lifecycle = {
        enabled = true,
        requireCloseReason = true,
        onlyAssignedCanClose = true,
        autoCloseAfter = 3600,       -- seconds, 0 keeps a call open until somebody closes it
        CloseReasons = { 'represented', 'advised', 'declined', 'noShow', 'duplicate' },
    },

    CitizenCalls = {
        enabled = true,
        Lines = {
            {
                enabled = true,
                command = '914',     -- /914 <what you need counsel for>
                priority = 'medium',
                targetJob = nil,     -- set to the defence job (with Config.PerJobData.dispatch) to route it there only
                cooldown = 180,
            },
        },
    },

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

{% hint style="info" %}
QF tablets use `/911` police, `/912` ambulance, `/913` mechanic and `/914` DOJ. A command belongs to one tablet only, and clashes with the tablets in `SiblingMDTs` are printed on start.
{% 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-1/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.
