Police alerts
Adding other types of police alerts
Dispatch system examples
Location: Client/functions_targets_open
------ / Robbery notification
RegisterNetEvent('estrp-unionheist:robberyinprogress')
AddEventHandler('estrp-unionheist:robberyinprogress',function(playerCoords,currentStreetName)
local PlayerData = QBCore.Functions.GetPlayerData()
if PlayerData.job.name == "police" then
Notifi({ title = Config.title, text = Text('unionrobbery').. " " .. currentStreetName, duration = 10000, icon = 'fa-solid fa-laptop-code', color = '#ff0000' })
RemoveBlip(blipunionrob)
blipunionrob = AddBlipForCoord(playerCoords)
SetBlipSprite(blipunionrob , 161)
SetBlipScale(blipunionrob , 2.0)
SetBlipColour(blipunionrob, 3)
PulseBlip(blipunionrob)
Wait(100000)
RemoveBlip(blipunionrob)
end
end)
function Policenotify()
local playerCoords = GetEntityCoords(PlayerPedId(-1))
local currentStreetName = GetCurrentStreetName()
TriggerServerEvent('estrp-unionheist:robberyinprogress', playerCoords,currentStreetName)
end
Location: Client/functions_targets_open
function Policenotify()
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
"Union Depository is being robbed",
{
{icon = "fa-venus-mars", info = gender}
},
{playerCoords.x, playerCoords.y, playerCoords.z},
"police",
3000,
11,
5,
true
)
end
Location: Server/functions_serv_open.lua
RegisterServerEvent('estrp-unionheist:robberyinprogress')
AddEventHandler('estrp-unionheist:robberyinprogress', function(playerCoords,currentStreetName)
local data = {displayCode = '10-10', description = 'Union Depository robbery', isImportant = 1, recipientList = {'police'}, length = '20000', infoM = 'fa-info-circle', info = 'Union Depository is being robbed'}
local dispatchData = {dispatchData = data, caller = 'Security System', coords = GetEntityCoords(GetPlayerPed(source))}
TriggerEvent('wf-alerts:svNotify', dispatchData)
end)
Last updated