# Custom Dispatch Calls

## How to create complete new call:

1. Go to `akre_dispatch/client/c_dispatches.lua`&#x20;
2. Change `MyNewDispatchCall()` to your own dispatch call name.&#x20;

It May be:&#x20;

```lua
local function PlaneHeist()
local function ArtGalleryHeist()
local function TrainHeist()
```

3. And don't foget also change `exports('MyNewDispatchCall', MyNewDispatchCall)` with the same name as you named the dispatch call.

<pre class="language-lua"><code class="lang-lua"><strong>local function MyNewDispatchCall()
</strong>    local plyData = QBCore.Functions.GetPlayerData() -- or for ESX = local plyData = ESX.GetPlayerData()
    local ped = PlayerPedId()
    local coords = GetEntityCoords(ped)
    local substreet = GetStreetNameAtCoord(coords.x, coords.y, coords.z)
    local streetname = GetStreetNameFromHashKey(substreet)
    local title = _L['your_tittle_name'] -- Go to locale/loc.lua and add ['your_tittle_name'] = 'Code｜Tittle',

    local text = "On the " .. streetname .. " has been a " .. gender .. '.'

    for k, v in pairs(Config.Jobs) do
        local job = v
        TriggerServerEvent('akre-dispatch:server:NewDispatch', job, title, text, coords)
    end
end

exports('MyNewDispatchCall', MyNewDispatchCall)
```
</code></pre>

4. Now go to akre\_dispatch/locale/loc.lua - and use this template to create the dispatch code and name that will be shown for the call:

```lua
['your_tittle_name'] = 'Code｜Name',
```

5. Change the text of your\_tittle\_name to your own in both files, i.e. c\_dispatches.lua and loc.lua. It should look something like this

```
['10-83_title'] = '10-83｜New Dispatch Call',
```

{% hint style="info" %}
If u don't want to use Code just delete it and use it in this form: \['10-83\_title'] = 'New Dispatch Call',
{% endhint %}

6. Now go to akre\_dispatch/client/c\_blips.lua and lets create a blip for our new dispatch call.

   ```lua
       elseif title == _L['10-83_title'] then
           blipSprite = 837
           blipColor = 76
           blipScale = 0.9
           blipLength = 45
           blipText = "911"
           Sound1, SoundVolume = 'dsp_beep', 10.0
   ```

{% hint style="danger" %}
The **title** have to match in every three files to make the correct connection!

```
_L['10-83_title']
```

{% endhint %}

7. Move back to akre\_dispatch/client/c\_dispatches.lua and edit your description&#x20;

   ```lua
   local text = "On the " .. streetname .. " has been a New Dispatch Call with: " .. gender .. '.'
   ```
8. Now customize which jobs receives the dispatch call

   ```lua
   -- ALL JOBS:    
       for k, v in pairs(Config.Jobs) do
           local job = v
           TriggerServerEvent('akre-dispatch:server:NewDispatch', job, title, text, coords)
       end
       
   -- POLICE JOBS ONLY:
       for k, v in pairs(Config.PoliceJobs) do
           local job = v
           TriggerServerEvent('akre-dispatch:server:NewDispatch', job, title, text, coords, panic)
       end
       
   -- OR CUSTOM    
           local job = "fire"
           TriggerServerEvent('akre-dispatch:server:NewDispatch', job, title, text, coords, panic)

   ```
9. If you have added a new dispatch call that has a new dispatch code or dispatch code does not remember to go to akre\_dispatch/ui/app.js and find const TitleColorMapping and add:

   ```javascript
       '10-83': { color: '#7b0e0a', text: 'Code-69' },
   // If you dont want to use text just let the '' empty
   // If didn't enter code enter first letter of title like this:
       'New Dispatch': { color: '#7b0e0a', text: 'Code-69' },
   ```
10. If you have all this done then create your export: \
    exports\['akre\_dispatch']:MyNewDispatchCall and follow another steps:

## Examples how to add calls to dispatch

#### QB-Jewelery&#x20;

*Find this trigger:*

<figure><img src="/files/vyupdytA9jVhj60c14JR" alt=""><figcaption><p>Before</p></figcaption></figure>

*and replace them with this:*&#x20;

**`exports["akre_dispatch"]:SuspiciousActivity()`**

<figure><img src="/files/sDIbkGWaDJpluph0Dq4L" alt=""><figcaption><p>After</p></figcaption></figure>

*Find this trigger:*

<figure><img src="/files/Nytozn2xffPDEqcSamIt" alt=""><figcaption><p>Before</p></figcaption></figure>

*And replace them with:*&#x20;

**`exports["akre_dispatch"]:JeweleryRobbery()`**

<figure><img src="/files/BmrA51Pggtdrv9BqFvr7" alt=""><figcaption><p>After</p></figcaption></figure>

{% hint style="warning" %}
Now Restart your server and Dispatch should shows the calls if alarm is triggered...
{% endhint %}


---

# 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://akre.gitbook.io/akre-docs/dispatch/custom-dispatch-calls.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.
