Police alerts
Adding other types of police alerts
Dispatch system examples
Location: Client/functions_open.lua
RegisterNetEvent('estrp-chopshop:client:vehicletheft')
AddEventHandler('estrp-chopshop:client:vehicletheft', function(playerCoords, currentStreetName)
local PlayerData = ESX.GetPlayerData()
if PlayerData.job.name == "police" then
-- Notify police about the vehicle theft
lib.defaultNotify({
title = 'Vehicle theft',
description = 'Dispatch: Possible vehicle theft at ' .. currentStreetName,
duration = 15000,
status = 'info'
})
-- Remove any existing blip for vehicle theft
if blipvehtheft then
RemoveBlip(blipvehtheft)
end
-- Add a new blip for the vehicle theft location
blipvehtheft = AddBlipForCoord(playerCoords)
SetBlipSprite(blipvehtheft, 161)
SetBlipScale(blipvehtheft, 2.0)
SetBlipColour(blipvehtheft, 3)
PulseBlip(blipvehtheft)
-- Remove the blip after 60 seconds
Citizen.Wait(60000)
RemoveBlip(blipvehtheft)
end
end)
Location: Client/functions_open.lua
RegisterNetEvent('estrp-chopshop:client:vehicletheft')
AddEventHandler('estrp-chopshop:client:vehicletheft', function(playerCoords, currentStreetName)
local PlayerData = ESX.GetPlayerData()
local playerCoords = GetEntityCoords(PlayerPedId(-1))
exports['core_dispatch']:addCall(
"10-10",
"Vehicle is being stolen at " .. currentStreetName,
{
{icon="fa-ruler", info=""},
},
{
playerCoords.x ,playerCoords.y ,playerCoords.z
},
"police",
3000,
11,
5,
false
)
end)
Location: Server/functions_open.lua
RegisterServerEvent('estrp-chopshop:server:vehicletheft')
AddEventHandler('estrp-chopshop:server:vehicletheft', function(playerCoords,currentStreetName)
local data = {displayCode = '10-10', description = 'Vehicle Theft', isImportant = 1, recipientList = {'police'}, length = '20000', infoM = 'fa-info-circle', info = 'Vehicle theft in progress'}
local dispatchData = {dispatchData = data, caller = 'Local citizen', coords = GetEntityCoords(GetPlayerPed(source))}
TriggerEvent('wf-alerts:svNotify', dispatchData)
end)
Last updated