Dispatch Configuration

Dispatch configuration, we have added some examples to simplify your work, but we strongly recommend that you hire or ask a developer for help so you don't have to problems within your server and everything works correctly.

For the dispatch system, we can configure our own dispatch system from the client or from the server. For this we will leave a configuration example using Quasar Dispatch.


Dispatch configuration and examples

In config/notifyCops.lua we can enable Config.Dispatch using the 'client' or 'server' option depending on the dispatch we want to add. Next we will see a configurable edited for Quasar Dispatch.

Both configurations for client or server will be made from the same notifyCops.lua file.

Client side configuration
Config.Dispatch = 'client'

function DispatchNotify(coords)
	local playerData = exports['qs-dispatch']:GetPlayerInfo()

        TriggerServerEvent('qs-dispatch:server:CreateDispatchCall', {
            job = { 'police', 'sheriff', 'traffic', 'patrol' },
            callLocation = playerData.coords,
            callCode = { code = '10-15', snippet = 'Drug sell' },
            message = "A ".. playerData.sex.. " is selling drug in ".. playerData.street_1.. "",
            flashes = false,
            image = image or nil,
            blip = {
                sprite = 488,
                scale = 1.5,
                colour = 1,
                flashes = true,
                text = 'Hight Speed',
                time = (20 * 1000),     --20 secs
            }
        })
end
Server side configuration
Config.Dispatch = 'server'

RegisterNetEvent('drugs:server:NotifyCops')
AddEventHandler('drugs:server:NotifyCops', function(coords)
    local street = GetStreetNameAtCoord(coords.x, coords.y, coords.z)
    local street2 = GetStreetNameFromHashKey(street)
    TriggerEvent('qs-dispatch:server:CreateDispatchCall', {
        job = { 'police', 'sheriff', 'traffic', 'patrol' },
        callLocation = street,
        callCode = { code = '<CALL CODE>', snippet = '<CALL SNIPPED EX: 10-10>' },
        message = "Call Message",
        flashes = false, -- you can set to true if you need call flashing sirens...
        image = "URL", -- Url for image to attach to the call 
        --you can use the getSSURL export to get this url
        blip = {
            sprite = 488, --blip sprite
            scale = 1.5, -- blip scale
            colour = 1, -- blio colour
            flashes = true, -- blip flashes
            text = 'Hight Speed', -- blip text
            time = (20 * 1000), --blip fadeout time (1 * 60000) = 1 minute
        },
        otherData = {
        -- optional if you dont need this you can remove it and remember remove the `,` after blip end and this block
           {
               text = 'Red Obscure', -- text of the other data item (can add more than one)
               icon = 'fas fa-user-secret', -- icon font awesome https://fontawesome.com/icons/
           }
         }
    })
end)

Last updated