# Dispatch System

{% hint style="info" %}
Here you will find the list of usable exports for Police Dispatch, you can use them if you have basic or advanced programming knowledge, we do not recommend using these if you do not have such knowledge.
{% endhint %}

{% hint style="warning" %}
REMEMBER TO CHOOSE CLIENT OR SERVER EXPORTS!
{% endhint %}

## OpenDispatch

Use following export / event to open dispatch.

{% tabs %}
{% tab title="Client Export" %}

```lua
exports['piotreq_gpt']:OpenDispatch()
```

{% endtab %}

{% tab title="Event" %}

```lua
TriggerEvent('piotreq_gpt:OpenDispatch')
```

{% endtab %}
{% endtabs %}

***

## SendAlert \[ONLY SERVER SIDE]

Use following export to send alert on dispatch.

```lua
exports['piotreq_gpt']:SendAlert(playerId, data)
```

* playerId: `number`
  * Sender server id
* data: `table`
  * title: `string`
  * icon?: `string`
  * code: `string`
  * jobs?: { \[jobName]: jobGrade }
  * info: \[ { icon: `string`, data?: `string`, isStreet?: `boolean` } ]
  * blip?: `blipData`
  * coords?: `vector3`
  * type?: `string` | "normal" / "risk"
  * canAnswer?: `boolean` | default false
  * maxOfficers?: `number` | default 4
  * time?: `number` | default 5
  * notifyTime?: `number` | default 7000

### blipData

* scale: `number`
* sprite: `number`
* category?: `number` | default `3`
* color: `number`
* hidden?: `boolean` | default `false` \[hidden on minimap if too far]
* priority?: `number` | default `5`
* short?: `boolean` | default `true`
* alpha?: `number` | default `255` \[0 - 255]
* name: `string` | blip name

### Example of Usage

{% hint style="warning" %}
Remember it's only EXAMPLE, you should change all data for your requirements.
{% endhint %}

```lua
exports['piotreq_gpt']:SendAlert(playerId --[[ SET PLAYER ID HERE ]], {
   title = 'Fleeca Bank Robbery',
   code = '10-90',
   icon = 'fa-solid fa-mask',
   info = {
       {icon = 'fa-solid fa-road', isStreet = true},
       {icon = 'fa-solid fa-triangle-exclamation', data = 'Very Danger'},
   },
   blip = { -- optional
       scale = 1.1,
       sprite = 1,
       category = 3, -- default 1
       color = 1,
       hidden = false, -- default false (hidden on legend)
       priority = 5, -- default 5
       short = true, -- as short range? default true
       alpha = 200, -- default 255
       name = "Fleeca Robbery"
   },
   type = 'risk', -- default normal
   canAnswer = true, -- default false
   maxOfficers = 6, -- default 4
   time = 10,-- 10 minutes, default 5
   notifyTime = 8000, -- 8 seconds, default 7
})
```


---

# Agent Instructions: 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:

```
GET https://piotreq-scripts.gitbook.io/piotreq-scripts/assets-and-guides/police-mdt/dispatch-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
