Police alerts
Adding other types of police alerts
Dispatch system examples
Location: Client/functions_open.lua
------- / Robbery notification
RegisterNetEvent('estrp-artheist:robberyinprogress')
AddEventHandler('estrp-artheist:robberyinprogress',function(playerCoords,currentStreetName)
if PlayerJob.name == "police" then
Notifi({ title = Config.title, text = Text('galleryrobbery').. " " .. currentStreetName, duration = 10000, icon = 'fa-solid fa-laptop-code', color = '#ff0000' })
RemoveBlip(blipgalleryrobbery)
blipgalleryrobbery = AddBlipForCoord(playerCoords)
SetBlipSprite(blipgalleryrobbery , 161)
SetBlipScale(blipgalleryrobbery , 2.0)
SetBlipColour(blipgalleryrobbery, 3)
PulseBlip(blipgalleryrobbery)
Wait(100000)
RemoveBlip(blipgalleryrobbery)
end
end)
function Policenotify()
local playerCoords = GetEntityCoords(PlayerPedId(-1))
local currentStreetName = GetCurrentStreetName()
TriggerServerEvent('estrp-artheist:robberyinprogress', playerCoords,currentStreetName)
end
Location: Client/functions_open.lua
------- / Robbery notification
--[[RegisterNetEvent('estrp-artheist:robberyinprogress')
AddEventHandler('estrp-artheist:robberyinprogress',function(playerCoords,currentStreetName)
if PlayerJob.name == "police" then
Notifi({ title = Config.title, text = Text('bobcatrobbery').. " " .. currentStreetName, duration = 10000, icon = 'fa-solid fa-laptop-code', color = '#ff0000' })
RemoveBlip(blipbobcat)
blipbobcat = AddBlipForCoord(playerCoords)
SetBlipSprite(blipbobcat , 161)
SetBlipScale(blipbobcat , 2.0)
SetBlipColour(blipbobcat, 3)
PulseBlip(blipbobcat)
Wait(100000)
RemoveBlip(blipbobcat)
end
end)
]]
function Policenotify()
local playerCoords = GetEntityCoords(PlayerPedId(-1))
local currentStreetName = GetCurrentStreetName()
exports['core_dispatch']:addCall(
"10-10",
"Art Gallery is being robbed: " .. currentStreetName,
{
{icon="fa-ruler", info=""},
},
{
playerCoords.x ,playerCoords.y ,playerCoords.z
},
"police",
3000,
11,
5,
false
)
end
------- / Robbery notification
--[[RegisterNetEvent('estrp-artheist:robberyinprogress')
AddEventHandler('estrp-artheist:robberyinprogress',function(playerCoords,currentStreetName)
if PlayerJob.name == "police" then
Notifi({ title = Config.title, text = Text('bobcatrobbery').. " " .. currentStreetName, duration = 10000, icon = 'fa-solid fa-laptop-code', color = '#ff0000' })
RemoveBlip(blipbobcat)
blipbobcat = AddBlipForCoord(playerCoords)
SetBlipSprite(blipbobcat , 161)
SetBlipScale(blipbobcat , 2.0)
SetBlipColour(blipbobcat, 3)
PulseBlip(blipbobcat)
Wait(100000)
RemoveBlip(blipbobcat)
end
end)
]]
function Policenotify()
local data = exports['cd_dispatch']:GetPlayerInfo()
TriggerServerEvent('cd_dispatch:AddNotification', {
job_table = {'police', },
coords = data.coords,
title = '10-15 - Art Gallery Robbery',
message = 'Art Gallery 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 - Art Gallery',
time = 5,
radius = 0,
}
})
end
------- / Robbery notification
RegisterNetEvent('estrp-artheist:robberyinprogress')
AddEventHandler('estrp-artheist:robberyinprogress',function(playerCoords,currentStreetName)
if PlayerJob.name == "police" then
exports['ps-dispatch']:ArtGalleryRobbery()
end
end)
function Policenotify()
local playerCoords = GetEntityCoords(PlayerPedId(-1))
local currentStreetName = GetCurrentStreetName()
TriggerServerEvent('estrp-artheist:robberyinprogress', playerCoords,currentStreetName)
end
Server side:
RegisterServerEvent('estrp-artheist:robberyinprogress')
AddEventHandler('estrp-artheist:robberyinprogress', function(playerCoords,currentStreetName)
TriggerClientEvent('estrp-artheist:robberyinprogress', source, playerCoords,currentStreetName)
end)
Location: Server/functions_serv_open.lua
RegisterServerEvent('estrp-artheist:robberyinprogress')
AddEventHandler('estrp-artheist:robberyinprogress', function(playerCoords,currentStreetName)
local data = {displayCode = '10-10', description = 'Art Gallery robbery', isImportant = 1, recipientList = {'police'}, length = '20000', infoM = 'fa-info-circle', info = 'Art Gallery is being robbed'}
local dispatchData = {dispatchData = data, caller = 'Art Gallery system', coords = GetEntityCoords(GetPlayerPed(source))}
TriggerEvent('wf-alerts:svNotify', dispatchData)
end)
Last updated