# Installation & Configuration & Integration

## <img src="/files/W1oatVHCMT6tBaAXr6T2" alt="" data-size="line">Step By Step Installation

### **Install**

Login to your [keymaster](https://keymaster.fivem.net/asset-grants/) account, check Granted Assets section and download script you bought from us&#x20;

**Script Start Order**

To correctly start the mdt script in your `server.cfg`, ensure to start the scripts in the following order. Failure to do so may result in various error codes

```
ensure es_extended
ensure ox_lib
ensure dusa_mdt
```

## <img src="/files/4JslPu1FspYQp1B97SK3" alt="" data-size="line"> Integrations - Compatibilities

To ensure that our script operates harmoniously with other scripts, you will need to adjust the following settings.

### Dispatch

To ensure the dispatch tab functions correctly, you need to make a small change to your dispatch script within your code.

#### 1-) ps-dispatch

If you are a ps-dispatch user, you need to make a small change to your dispatch system:

1. Find ps-dispatch on your resources folder
2. Go to path ps-dispatch/client/main.lua
3. Find event named:

   ```lua
   ps-dispatch:client:notify
   ```
4. Replace the whole code with code block at the below, or just add this code to right place:

   ```lua
   exports['dusa_mdt']:SendDispatch(data, source)
   ```

<pre class="language-lua"><code class="lang-lua"><strong>RegisterNetEvent('ps-dispatch:client:notify', function(data, source)
</strong>    if data.alertTime == nil then data.alertTime = Config.AlertTime end
    local timer = data.alertTime * 1000
    
    if alertsDisabled then return end
    if not isJobValid(data.jobs) then return end
    if not IsOnDuty() then return end

    timerCheck = true

    SendNUIMessage({
        action = 'newCall',
        data = {
            data = data,
            timer = timer,
        }
    })

    addBlip(data, Config.Blips[data.codeName] or data)

    RespondToDispatch:disable(false)
    OpenDispatchMenu:disable(true)

    local startTime = GetGameTimer()
    while timerCheck do
        Wait(1000)

        local currentTime = GetGameTimer()
        local elapsed = currentTime - startTime

        if elapsed >= timer then
            break
        end
    end

    exports['dusa_mdt']:SendDispatch(data, source)
    timerCheck = false
    OpenDispatchMenu:disable(false)
    RespondToDispatch:disable(true)
end)
</code></pre>

It should look like this at the end.

After completing these steps, our system will operate seamlessly with ps-dispatch

#### 2-) rcore\_dispatch

If you are a rcore\_dispatch user, you need to make a small change to your dispatch system:

integrations will be added here

### Billing

#### ...

### Jail

...

### Community Service

...

## API

The details for operations in this category have not been provided extensively, as anyone with basic knowledge can perform the necessary actions. Therefore, it is recommended to reserve this part more for your developers. Developers can refer to the provided snippets and integrate them into your scripts for extended functionality.&#x20;

### client

#### Insert Dispatches to MDT

To insert your dispatches for MDT to manage them, use this function at your dispatch script

But before that, make sure you integrated your dispatch to `modules/dispatch/scripts/custom.lua`&#x20;

If there is a file named your dispatch script, that means your dispatch is already integrated by us.

#### Export

```lua
exports['dusa_mdt']:SendDispatch(data)
```

#### Parameters

| Name   | Data Type | Description                                    |
| ------ | --------- | ---------------------------------------------- |
| `data` | table     | Table of data related to the reported incident |

***

## Common Errors

### Common Error Codes and Solutions

If you're encountering issues with the MDT system, it may be a simple fix. Review the error codes below to identify and resolve your specific issue:

<pre><code><strong>// server.cfg
</strong>ensure es_extended
ensure ox_lib
ensure dusa_mdt
</code></pre>

* **Error 101 : Throws many errors when script started at first start of server**&#x20;
  * **Error report screenshots may look like ;**&#x20;

    <figure><img src="/files/yOyn9lFLu2RAkUlu1I4l" alt=""><figcaption><p>at server cmd</p></figcaption></figure>

    <figure><img src="/files/kpDa3O07Fm6ZKUtjMfWQ" alt=""><figcaption><p>at f8 console</p></figcaption></figure>

    * **Solution**: Check your server.cfg start order. The order should be like this
    * ```
      // server.cfg
      ensure es_extended
      ensure ox_lib
      ensure dusa_mdt
      ```
* **Error 202**: New dispatchs are not listed in my mdt
  * **Solution**: Follow integration step depends on your dispatch system.
* **Error 303**: .
  * **Solution**:
* **Error 404**: .

  * **Solution**:&#x20;

  Remember to always check the latest documentation for any updates or changes to error codes and solutions.


---

# 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://dusadev.gitbook.io/dusa-docs/esx/police-mdt/installation-and-configuration-and-integration.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.
