Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion client/eventhandlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,23 @@ local function isPedAWitness(witnesses, ped)
return false
end

---@param ped number | Ped ID to check
---@return boolean | Returns true if the ped is holding a whitelisted gun
local function BlacklistedWeapon(ped)
for i = 1, #Config.WeaponWhitelist do
local weaponHash = GetHashKey(Config.WeaponWhitelist[i])
if GetSelectedPedWeapon(ped) == weaponHash then
return true -- Is a whitelisted weapon
end
end
return false -- Is not a whitelisted weapon
end

AddEventHandler('CEventGunShot', function(witnesses, ped)
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

Expand Down
19 changes: 19 additions & 0 deletions shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ Config.Locations = {
},
}

-- Whitelist Guns that do not send shooting alerts
Config.WeaponWhitelist = {
'WEAPON_GRENADE',
'WEAPON_BZGAS',
'WEAPON_MOLOTOV',
'WEAPON_STICKYBOMB',
'WEAPON_PROXMINE',
'WEAPON_SNOWBALL',
'WEAPON_PIPEBOMB',
'WEAPON_BALL',
'WEAPON_SMOKEGRENADE',
'WEAPON_FLARE',
'WEAPON_PETROLCAN',
'WEAPON_FIREEXTINGUISHER',
'WEAPON_HAZARDCAN',
'WEAPON_RAYCARBINE',
'WEAPON_STUNGUN'
}

Config.Blips = {
['vehicleshots'] = { -- Need to match the codeName in alerts.lua
radius = 0,
Expand Down