# 🚨 Dispatch Alert

## 📘 MDT Alert System – Server Side Trigger

### 🔔 Event: `kartik-mdt:server:sendDispatchNotification`

### ✅ **Usage Example (Server Side)**

<pre class="language-lua"><code class="lang-lua"><strong>local dispatchData = {
</strong>    title = "Shots Fired",
    code = "10-71",
    description = "Multiple shots fired near Legion Square",
    location = "Legion Square",
    sound = "dispatch", 
    x = 215.76,
    y = -810.12,
    z = 30.73,
    type = "Alert", -- or "Call"
    person = {
        name = "John Doe",
        phone = "123-456-7890",
        citizenid = "CIT12345"
    },
    weapon = {
        name = "WEAPON_PISTOL"
    },
    blip = {
        radius = 75.0,
        sprite = 161,
        color = 1,
        scale = 1.2,
        length = 5 -- in minutes
    },
    jobs = {
        police = true,
        ems = true
    }
}
<strong>
</strong><strong>TriggerEvent('kartik-mdt:server:sendDispatchNotification', dispatchData)
</strong></code></pre>

***

### 📦 **Payload Structure**

#### `AlertData` (Table)

| Field         | Type         | Required | Description                                                            |
| ------------- | ------------ | -------- | ---------------------------------------------------------------------- |
| `title`       | string       | ✅ Yes    | The title shown in the dispatch alert.                                 |
| `code`        | string       | ✅ Yes    | The alert code (e.g., 10-71, 10-50).                                   |
| `description` | string       | ✅ Yes    | A short description of what’s happening.                               |
| `location`    | string       | ✅ Yes    | Name of the street/location for the alert.                             |
| `x`, `y`, `z` | number       | ✅ Yes    | World coordinates for the alert.                                       |
| `sound`       | string       | ❌ No     | File name of the sound from `sounds/` folder. Default is `"dispatch"`. |
| `type`        | string       | ❌ No     | Type of alert: `"Alert"` or `"Call"`. Default is `"Alert"`.            |
| `person`      | `PersonData` | ❌ No     | Details of the person involved.                                        |
| `weapon`      | `WeaponData` | ❌ No     | Details of the weapon involved.                                        |
| `vehicle`     | table/number | ❌ No     | Vehicle entity or data.                                                |
| `blip`        | `BlipData`   | ❌ No     | Blip configuration for map.                                            |
| `jobs`        | table        | ❌ No     | Jobs to notify. Example: `{ police = true, ems = true }`               |

***

### 🧠 **Tips**

* Use this from **server-side scripts** where an alert should be triggered due to an event (e.g., shooting, car theft, panic button).
* The `vehicle` field can be a numeric vehicle entity ID or a custom table with preformatted data.
* Use `blip.length` to auto-remove the blip after a set number of minutes.

***

### 🔄 Related Export

You can also use the **client-side export**:

```lua
exports['kartik-mdt']:CustomAlert(alertData)
```

But for **server-side**, always use:

```lua
TriggerEvent('kartik-mdt:server:sendDispatchNotification', alertData)
```

***
