# Police alerts

{% hint style="info" %}
Adding other types of police alerts
{% endhint %}

## Dispatch system examples

{% tabs %}
{% tab title="Default" %}

#### Location: Client/functions.lua

{% code fullWidth="true" %}

```lua
RegisterNetEvent('estrp-shoprobbery:cashregisterrobbery')
AddEventHandler('estrp-shoprobbery:cashregisterrobbery',function(playerCoords,currentStreetName)
    local PlayerData = QBCore.Functions.GetPlayerData()
    if PlayerData.job.name == "police" then
        lib.defaultNotify({
            title = 'Store robbery warning',
            description = 'Dispatch: Someone is robbing the store! Location: ' .. currentStreetName,
            duration = 15000,
            status = 'error'
        })
       -- exports['mythic_notify']:SendAlert('error', 'Dispatch: Someone is robbering the store ' .. currentStreetName , 10000) 
        RemoveBlip(blipRobbery)
        blipRobbery = AddBlipForCoord(playerCoords)
        SetBlipSprite(blipRobbery , 161)
        SetBlipScale(blipRobbery , 2.0)
        SetBlipColour(blipRobbery, 3)
        PulseBlip(blipRobbery)
        Wait(60000)
        RemoveBlip(blipRobbery)
        
        end
    end)
```

{% endcode %}

{% endtab %}

{% tab title="Core Dispatch" %}
Location: Client/functions.lua

{% code fullWidth="true" %}

```lua
function Policenotifyregister()
        local playerCoords = GetEntityCoords(PlayerPedId(-1))
        local gender = IsPedMale(PlayerPedId(-1)) and 'male' or 'female'
        exports['core_dispatch']:addCall(
            "66-6", --dont mind the call number xD
            "24/7 Store security silent alarm",
            {
                {icon = "fa-venus-mars", info = gender}
    
            },
            {playerCoords.x, playerCoords.y, playerCoords.z},
        "police",
        3000,
        11,
        5,
        true
        )
    end
```

{% endcode %}
{% endtab %}

{% tab title="CD\_Dispatch" %}

```lua
function Policenotifyregister(
     local data = exports['cd_dispatch']:GetPlayerInfo()
        TriggerServerEvent('cd_dispatch:AddNotification', {
            job_table = {'police', }, 
            coords = data.coords,
            title = '10-15 - Store Robbery',
            message = 'Store security alarm went off!', 
            flash = 0,
            unique_id = data.unique_id,
            sound = 1,
            blip = {
                sprite = 431, 
                scale = 1.2, 
                colour = 3,
                flashes = true, 
                text = '112 - Store Security',
                time = 5,
                radius = 0,
            }
        })
end
```

{% endtab %}

{% tab title="Linden Outlawalert" %}

#### Location: Server/functions\_serv\_open.lua

```lua
RegisterServerEvent('estrp-shoprobbery:cashregisterrobbery')
AddEventHandler('estrp-shoprobbery:cashregisterrobbery', function(playerCoords,currentStreetName)
local data = {displayCode = '10-10', description = 'Store robbery', isImportant = 1, recipientList = {'police'}, length = '20000', infoM = 'fa-info-circle', info = 'Store is being robbed'}
local dispatchData = {dispatchData = data, caller = 'Store Security System', coords = GetEntityCoords(GetPlayerPed(source))}
TriggerEvent('wf-alerts:svNotify', dispatchData)
end)
```

{% endtab %}
{% endtabs %}
