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

# Configuration

## Languages

You can set the language of the script in the configuration file.

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

```lua
Config.Locale = "en-US"
```

### Commands & Keybinds <a href="#user-content--new-section-commands--keybinds" id="user-content--new-section-commands--keybinds"></a>

**General**

* `/mdtambulance` (DELETE): Toggle the MDT Dashboard.
* `/qfmdtambulancebadge` (B): Show/Hide Medic Badge.
* `/bodycam`: Toggle Bodycam Overlay.

**Camera Mode**

* `/qfmdtambulancestartcapturephoto` (ENTER / SPACE): Take a photo.
* `/qfmdtambulanceblocknuifocus` (L-ALT / RMB): Toggle mouse focus.
* `/qfmdtambulancecameratoggleflashlight` (F): Toggle camera flashlight.
* `/qfmdtambulancecameratoggleside` (R): Switch between Front/Back camera.

{% hint style="info" %} <mark style="color:$info;">Note: All keys are fully configurable in config.lua</mark>*<mark style="color:$info;">.</mark>*
{% endhint %}

### Configuration <a href="#user-content-configuration" id="user-content-configuration"></a>

The `config/config.lua` file contains the core settings for the resource. Below is a breakdown of the key sections:

#### Main Settings <a href="#user-content-main-settings" id="user-content-main-settings"></a>

| Option              | Description                                        | Example                             |
| ------------------- | -------------------------------------------------- | ----------------------------------- |
| `Config.Frameworks` | Enable or disable support for specific frameworks. | `{ ESX = { enabled = true }, ... }` |
| `Config.Debug`      | Enables debug prints in the server console.        | `true` / `false`                    |

#### Features <a href="#user-content-features" id="user-content-features"></a>

| Option             | Description                                                                  |
| ------------------ | ---------------------------------------------------------------------------- |
| `Config.ToggleMDT` | Controls the keybind and command to open the MDT.                            |
| `Config.Camera`    | Settings for the integrated camera system (blocking NUI focus, capture key). |
| `Config.Badge`     | Settings for the medic badge display (keybind, command).                     |
| `Config.Basics`    | Visual customization, primarily the primary color using HSL format.          |

#### NUI Settings (`Config.NUI`) <a href="#user-content-nui-settings-confignui" id="user-content-nui-settings-confignui"></a>

This section controls the visual aspect and functionality of the UI:

* **`fractionName`**: The short name displayed for the department (e.g., "EMS").
* **`primaryColor`**: The implementation of the primary color in RGB format for the UI.
* **`sidebarPages`**: Toggle visibility of specific sidebar pages (e.g., set `home = { show = false }` to hide the home page).
* **`medications`**: Define available medications, their dosage rates, and units.
* **`medProtocols`**: Define medical protocols, side effects, and contraindications for each medication.

#### Gameplay Systems <a href="#user-content-gameplay-systems" id="user-content-gameplay-systems"></a>

* **`Config.Pharmacy`**: Configures the pharmacy NPC, location, and blip. Supported `targetSystem` options include `ox_target`, `qb-target`, `qtarget`, or `auto`.
* **`Config.PrescriptionSettings`**: logical settings for prescriptions, including the item name and effects of specific drugs (speed, armor, health regeneration).
* **`Config.Map`**: Configuration for the live map, including hospital locations and vehicle types to track.
* **`Config.Dispatch`**: Settings for the dispatch system, including ignored jobs and alert history duration.

***

### Exports (Server-side) <a href="#user-content--exports-server-side" id="user-content--exports-server-side"></a>

#### `AddLog` <a href="#user-content-addlog" id="user-content-addlog"></a>

Adds a new entry to the audit log system. This is useful for logging actions from other scripts into the MDT.

**Parameters:**

* `source` (number|nil): The player source ID. If `nil`, it is logged as "System".
* `tag` (string): The category tag for the log (e.g., "Admission", "Prescription", "Hospital").
* `text` (string): The main content of the log message.
* `color` (string): The color tag for the entry. Supported: `"blue"`, `"red"`, `"green"`, `"orange"`, `"black"`.
* `fields` (table|nil): Key-value pairs of additional data to store (e.g., `{ patient = "Name", amount = 500 }`).
* `args` (table|nil): Arguments for translation placeholders if `text` is a translation key.

**Return:** `void`

**Example:**

```lua
-- Log a patient admission

exports.qf_mdt_ambulance_v2:AddLog(    
    source,     
    "New Patient",     
    "Admitted John Doe to the hospital",     
    "blue",     
    {         
        patient = "John Doe",         
        reason = "Fractured Arm",         
        room = "204"     
    }
)
```

***

### Exports (Client-side) <a href="#user-content--exports-client-side" id="user-content--exports-client-side"></a>

#### `CreateDispatchAlert` <a href="#user-content-createdispatchalert" id="user-content-createdispatchalert"></a>

Creates a dispatch alert that appears on the MDT map and list for on-duty medics.

**Parameters:**

* `coords` (vector3): The world coordinates of the alert.
* `title` (string): The title of the alert (e.g., "Cardiac Arrest", "Injured Person").
* `description` (string): A detailed description of the incident.
* `code` (string): The dispatch code (e.g., "10-13", "10-99").
* `colorRGB` (table): A table `{r, g, b}` representing the alert color.
* `maxMedics` (number): The maximum number of units that can attach to this alert.
* `duration` (number): How long (in ms) the alert stays active.

**Return:** `void`

**Example:**

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

exports.qf_mdt_ambulance_v2:CreateDispatchAlert(    
    playerCoords,    
    "Car Accident",    
    "Reported vehicle collision with injuries",    
    "10-50",    
    { 255, 165, 0 },   
    3,  
    15000
)
```

#### `showBodycam` <a href="#user-content-showbodycam" id="user-content-showbodycam"></a>

Forces the Bodycam UI to become visible.

**Example:**

```lua
exports.qf_mdt_ambulance_v2:showBodycam()
```

#### `hideBodycam` <a href="#user-content-hidebodycam" id="user-content-hidebodycam"></a>

Forces the Bodycam UI to hide.

**Example:**

```lua
exports.qf_mdt_ambulance_v2:hideBodycam()
```

#### `toggleBodycam` <a href="#user-content-togglebodycam" id="user-content-togglebodycam"></a>

Toggles the current state of the Bodycam UI.

**Example:**

```lua
exports.qf_mdt_ambulance_v2:toggleBodycam()
```

#### `showMedicBadge` <a href="#user-content-showmedicbadge" id="user-content-showmedicbadge"></a>

Displays the medic badge card on the screen.

**Parameters:**

* `data` (table): A table containing the badge details.
  * `name` (string): The name displayed on the badge.
  * `gradeLabel` (string): The rank or title.
  * `badge` (string): The badge number.
  * `mugshot` (string): URL to the image or base64 string.
  * `duration` (number): Time in ms to display the badge.
  * `licenses` (table): List of licenses `{ {label="Driver", active=true}, ... }`.

**Example:**

```lua
exports.qf_mdt_ambulance_v2:showMedicBadge(
    {    
        name = "Dr. House",    
        gradeLabel = "Chief of Medicine",    
        badge = "001",    
        mugshot = "https://example.com/house.jpg", -- or Base64    
        duration = 5000,    
        licenses = {        
            { label = "Medical License", active = true },        
            { label = "Driver License", active = true }    
        }
    }
)
```

#### `GetMugShotBase64` <a href="#user-content-getmugshotbase64" id="user-content-getmugshotbase64"></a>

Captures a mugshot of the specified ped and returns it as a Base64 string.

**Parameters:**

* `Ped` (entity): The ped handle to capture.
* `Transparent` (boolean): If `true`, attempts to remove the background (requires game support).

**Return:**

* `string`: The Base64 encoded image.

**Example:**

```lua
local ped = PlayerPedId()
local base64 = exports.qf_mdt_ambulance_v2:GetMugShotBase64(ped, false)

print("Captured mugshot length:", #base64)
```

***

### Events <a href="#user-content--events" id="user-content--events"></a>

#### Client Events <a href="#user-content-client-events" id="user-content-client-events"></a>

**`qf_mdt_ambulance_v2:client:openPharmacy`**

Opens the pharmacy prescription redemption menu. This can be used by third-party target systems or interaction scripts.

**Usage:**

```lua
TriggerEvent('qf_mdt_ambulance_v2:client:openPharmacy')
```

### Dispatch Integrations & Custom Alerts

#### Compatibility

Enable 3rd party script compatibility by editing `config/config.lua`.

```lua
-- Enable external dispatch scripts in config/config.lua
Config.Dispatch = {
    Integration = {
        rcore_dispatch = true, -- Set to true to automatically bridge alerts
        core_dispatch = false,
        opto_dispatch = false,
        tk_dispatch = false
    }
}
```

#### Custom Alerts

Control and send dispatch alerts to the MDT programmatically.

```lua
-- Send a custom dispatch alert manually from any server script
TriggerEvent('qf_mdt_ambulance_v2/server/addCustomDispatch', {
    id = "custom_alert_123",          -- (Optional) Unique ID, system generates one if empty
    title = "Injured Person",         -- Alert title/name
    code = "10-90",                   -- Dispatch code
    color = {255, 0, 0},              -- RGB color table or HEX string (e.g., "#FF0000")
    street = "Route 68",              -- (Optional) Street name or location description
    x = 100.5,                        -- X coordinate of the alert
    y = -213.2,                       -- Y coordinate of the alert
    z = 32.5,                         -- Z coordinate of the alert
    max_medics = 6,                   -- (Optional) Maximum medics that can react (default: 10)
    duration = 5000                   -- (Optional) Duration the alert stays on screen in ms (default: 5000)
})
```

## Resetting Medic Hours <a href="#user-content-5-resetting-medic-hours-ambulance" id="user-content-5-resetting-medic-hours-ambulance"></a>

The Ambulance MDT tracks on-duty hours for all medical personnel. To clear these hours (e.g., at the end of a month), you can trigger the internal server callback. The requester must be on-duty and authorized to perform this action.

* **Callback Name:** `qf_mdt_ambulance_v2/resetMedicHours`
* **Target Identifier:** `id` (Character Identifier / CitizenID / License)

```lua
local medicId = "MEDIC_001"

CALLBACK.TriggerServerCallback('qf_mdt_ambulance_v2/resetMedicHours', function(result)
    if result.success then
        print("Medic hours have been reset successfully.")
    else
        print("Error: " .. result.error)
    end
end, medicId)
```

## Duty Status Change Hook <a href="#user-content-7-duty-status-change-hook-ambulance" id="user-content-7-duty-status-change-hook-ambulance"></a>

Similar to the Police MDT, the Ambulance MDT includes a hook for medic status changes. This allows you to run custom server-side logic whenever a medic toggles their availability or is kicked from duty by a supervisor.

* **Location:** `config/server/editable.lua`
* **Function:** `EDITABLE.OnStatusChange(source, status)`

**Usage Example**

You can use this to keep the player's job state in sync with the MDT interface:

```lua
function EDITABLE.OnStatusChange(source, status)
    -- Triggered for status: "available", "unavailable"
    
    if status == "available" then
        -- Example: Triggering a custom onDuty event
        TriggerEvent('exampleambulancejob:onDuty', source)
    elseif status == "unavailable" then
        -- Example: Triggering a custom offDuty event
        TriggerEvent('exampleambulancejob:offDuty', source)
    end
end
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
