🚨Police alerts
Adding other types of police alerts
Dispatch system examples
Location: Client/functions.lua
------- / Robbery notification
RegisterNetEvent('estrp-fleeca:robberyinprogress')
AddEventHandler('estrp-fleeca:robberyinprogress',function(playerCoords,currentStreetName)
if PlayerJob.name == "police" then
--[[ or for QBCore:
local PlayerData = QBCore.Functions.GetPlayerData()
if PlayerData.job.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-fleeca:robberyinprogress', playerCoords,currentStreetName)
end
Location: Client/functions.lua
------- / Robbery notification
--[[RegisterNetEvent('estrp-fleeca:robberyinprogress')
AddEventHandler('estrp-fleeca: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",
"Fleeca bank is being robbed: " .. currentStreetName,
{
{icon="fa-ruler", info=""},
},
{
playerCoords.x ,playerCoords.y ,playerCoords.z
},
"police",
3000,
11,
5,
false
)
end
------- / Robbery notification
--[[ RegisterNetEvent('estrp-fleeca:robberyinprogress')
AddEventHandler('estrp-fleeca: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 data = exports['cd_dispatch']:GetPlayerInfo()
TriggerServerEvent('cd_dispatch:AddNotification', {
job_table = {'police', },
coords = data.coords,
title = '10-15 - Fleeca Bank alarm',
message = 'The Alarm of a Fleeca Bank went off! Location: '..data.street,
flash = 0,
unique_id = data.unique_id,
sound = 1,
blip = {
sprite = 431,
scale = 1.2,
colour = 3,
flashes = false,
text = '112 - Fleeca Bank Alarm',
time = 5,
radius = 0,
}
})
end
Location: Client/functions.lua
------- / Robbery notification
RegisterNetEvent('estrp-fleeca:robberyinprogress')
AddEventHandler('estrp-fleeca:robberyinprogress',function(playerCoords,currentStreetName)
if PlayerJob.name == "police" then
--[[ or for QBCore:
local PlayerData = QBCore.Functions.GetPlayerData()
if PlayerData.job.name == "police" then ]]--
exports['ps-dispatch']:FleecaBankRobbery(camId)
end
end)
function Policenotify()
local playerCoords = GetEntityCoords(PlayerPedId(-1))
local currentStreetName = GetCurrentStreetName()
TriggerServerEvent('estrp-fleeca:robberyinprogress', playerCoords,currentStreetName)
end
Serverside
RegisterServerEvent('estrp-fleeca:robberyinprogress')
AddEventHandler('estrp-fleeca:robberyinprogress', function(playerCoords,currentStreetName)
TriggerClientEvent('estrp-fleeca:robberyinprogress', source, playerCoords,currentStreetName)
end)
Location: Server/functionsserv.lua
RegisterServerEvent('estrp-fleeca:robberyinprogress')
AddEventHandler('estrp-fleeca:robberyinprogress', function(playerCoords,currentStreetName)
local data = {displayCode = '10-10', description = 'Fleeca Bank Robbery', isImportant = 1, recipientList = {'police'}, length = '20000', infoM = 'fa-info-circle', info = 'Fleeca bank robbery in progress'}
local dispatchData = {dispatchData = data, caller = 'Bank Security System', coords = GetEntityCoords(GetPlayerPed(source))}
TriggerEvent('wf-alerts:svNotify', dispatchData)
end)
Last updated