# Police alerts

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

## Dispatch system examples

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

#### Location: Client/functions\_open.lua

{% code fullWidth="true" %}

```lua
------- / Robbery notification
RegisterNetEvent('estrp-pacificbank:robberyinprogress')
AddEventHandler('estrp-pacificbank:robberyinprogress',function(playerCoords,currentStreetName)
    if PlayerJob.name == "police" then
        Notifi({ title = Config.title, text = Text('bankrobbery').. " " .. currentStreetName, duration = 10000, icon = 'fa-solid fa-laptop-code', color = '#ff0000' })
        RemoveBlip(blipbankrobbery)
        blipbankrobbery = AddBlipForCoord(playerCoords)
        SetBlipSprite(blipbankrobbery , 161)
        SetBlipScale(blipbankrobbery , 2.0)
        SetBlipColour(blipbankrobbery, 3)
        PulseBlip(blipbankrobbery)
        Wait(100000)
        RemoveBlip(blipbankrobbery)
        
        end
    end)

function Policenotify()
        local playerCoords = GetEntityCoords(PlayerPedId(-1))
        local currentStreetName = GetCurrentStreetName()
        TriggerServerEvent('estrp-pacificbank:robberyinprogress', playerCoords,currentStreetName)
end
```

{% endcode %}
{% endtab %}

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

{% code fullWidth="true" %}

```lua
------- / Robbery notification
--[[RegisterNetEvent('estrp-pacificbank:robberyinprogress')
AddEventHandler('estrp-pacificbank:robberyinprogress',function(playerCoords,currentStreetName)
    if PlayerJob.name == "police" then
        Notifi({ title = Config.title, text = Text('bankrobbery').. " " .. currentStreetName, duration = 10000, icon = 'fa-solid fa-laptop-code', color = '#ff0000' })
        RemoveBlip(blipbankrobbery)
        blipbankrobbery = AddBlipForCoord(playerCoords)
        SetBlipSprite(blipbankrobbery , 161)
        SetBlipScale(blipbankrobbery , 2.0)
        SetBlipColour(blipbankrobbery, 3)
        PulseBlip(blipbankrobbery)
        Wait(100000)
        RemoveBlip(blipbankrobbery)
        
        end
    end)
]]
function Policenotify()
    local playerCoords = GetEntityCoords(PlayerPedId(-1))
    local currentStreetName = GetCurrentStreetName()
    exports['core_dispatch']:addCall(
     "10-10", 
        "Pacific Bank is being robbed: " .. currentStreetName,
    {
        {icon="fa-ruler", info=""},
    },
    {
        playerCoords.x ,playerCoords.y ,playerCoords.z 
    },
    "police", 
    3000, 
    11, 
    5,
    false
)
end
```

{% endcode %}
{% endtab %}

{% tab title="Linden Outlawalert" %}

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

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

{% endtab %}
{% endtabs %}
