Custom Dispatch Calls

How do I ensure that I receive notifications about robberies and other custom calls in the dispatch? It is necessary to make changes to the exports that scripts have or that have been changed to cust

How to create complete new call:

  1. Go to akre_dispatch/client/c_dispatches.lua

  2. Change MyNewDispatchCall() to your own dispatch call name.

It May be:

local function PlaneHeist()
local function ArtGalleryHeist()
local function TrainHeist()
  1. And don't foget also change exports('MyNewDispatchCall', MyNewDispatchCall) with the same name as you named the dispatch call.

local function MyNewDispatchCall()
    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)
```
  1. 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:

['your_tittle_name'] = 'Code|Name',
  1. 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',

If u don't want to use Code just delete it and use it in this form: ['10-83_title'] = 'New Dispatch Call',

  1. Now go to akre_dispatch/client/c_blips.lua and lets create a blip for our new dispatch call.

        elseif title == _L['10-83_title'] then
            blipSprite = 837
            blipColor = 76
            blipScale = 0.9
            blipLength = 45
            blipText = "911"
            Sound1, SoundVolume = 'dsp_beep', 10.0
  1. Move back to akre_dispatch/client/c_dispatches.lua and edit your description

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

    -- 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)
    
  3. 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:

        '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' },
  4. 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

Find this trigger:

Before

and replace them with this:

exports["akre_dispatch"]:SuspiciousActivity()

After

Find this trigger:

Before

And replace them with:

exports["akre_dispatch"]:JeweleryRobbery()

After

Last updated