Dispatch/Shots Fired
Dispatch Script Adjustment In your dispatch script, search for "shot" or "shooting" and add the following if statement to remove shots fired calls when players are in a paintball match:
if exports["pug-paintball"]:IsInPaintball() then return end
Example for ps-dispatch/client/eventhandlers.lua:
AddEventHandler('CEventGunShot', function(witnesses, ped)
if exports["pug-paintball"]:IsInPaintball() then return end
if IsPedCurrentWeaponSilenced(cache.ped) then return end
if inNoDispatchZone then return end
if BlacklistedWeapon(cache.ped) then return end
WaitTimer('Shooting', function()
if cache.ped ~= ped then return end
if PlayerData.job.type == 'leo' then
if not Config.Debug then
return
end
end
if inHuntingZone then
exports['ps-dispatch']:Hunting()
return
end
if witnesses and not isPedAWitness(witnesses, ped) then return end
if cache.vehicle then
exports['ps-dispatch']:VehicleShooting()
else
exports['ps-dispatch']:Shooting()
end
end)
end)
CD_DISPATCH REPLACEMENT
Replace this portion in cd_dispatch/client/policealerts.lua to remove shots fired calls if you are using cd_dispatch
if Config.PoliceAlerts.GunShots.ENABLE then
CreateThread(function()
while not Authorised do Wait(1000) end
while true do
wait = 500
local ped = PlayerPedId()
local has_weapon, weapon_hash = GetCurrentPedWeapon(ped)
if has_weapon then wait = 5 end
if IsPedShooting(ped) and not IsPedCurrentWeaponSilenced(ped) then
if not Config.PoliceAlerts.GunShots.WhitelistedWeapons[weapon_hash] then
if not IsPlayerJobWhitelisted() and not IsPlayerInGunshotWhitelistZone() and IsWitnessPedInArea() then
if not exports["pug-paintball"]:IsInPaintball() then
local weapon_name = Config.PoliceAlerts.GunShots.WeaponLabels[weapon_hash]
if weapon_name == nil then weapon_name = L('firearm') end
local in_vehicle = IsPedInAnyVehicle(ped, true)
local data = GetPlayerInfo()
local message
if in_vehicle then
message = L('policealerts_gunshots_message_1', data.vehicle_colour, data.vehicle_label, data.vehicle_plate, data.heading, data.street)
else
message = L('policealerts_gunshots_message_2', data.sex, weapon_name, data.street)
end
TriggerServerEvent('cd_dispatch:AddNotification', {
job_table = Config.PoliceAlerts.police_jobs,
coords = data.coords,
title = L('policealerts_gunshots_title'),
message = message,
flash = 0,
unique_id = data.unique_id,
sound = 1,
blip = {
sprite = 313,
scale = 1.2,
colour = 3,
flashes = false,
text = L('policealerts_gunshots_title'),
time = 5,
radius = 100,
}
})
if Config.PoliceAlerts.add_bolos and in_vehicle then
TriggerServerEvent('cd_dispatch:pdalerts:Gunshots', data)
end
end
Wait(Config.PoliceAlerts.cooldown*1000)
end
end
end
Wait(wait)
end
end)
end
Last updated