diff --git a/client/eventhandlers.lua b/client/eventhandlers.lua index 3757f729..6c7be0ec 100644 --- a/client/eventhandlers.lua +++ b/client/eventhandlers.lua @@ -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 diff --git a/shared/config.lua b/shared/config.lua index dd99f806..3c6c4dbe 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -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,