From 2d7aee4a31345ca6c3af8a63096f565666ad632d Mon Sep 17 00:00:00 2001 From: LeSiiN <103898231+LeSiiN@users.noreply.github.com> Date: Sun, 3 Dec 2023 13:45:18 +0100 Subject: [PATCH 1/4] Update config.lua --- shared/config.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/shared/config.lua b/shared/config.lua index dd99f806..a50432e8 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, From 0721e3f3c3a248b27096c3d6a0d639c06c273bec Mon Sep 17 00:00:00 2001 From: LeSiiN <103898231+LeSiiN@users.noreply.github.com> Date: Sun, 3 Dec 2023 13:45:58 +0100 Subject: [PATCH 2/4] Update eventhandlers.lua --- client/eventhandlers.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/eventhandlers.lua b/client/eventhandlers.lua index 3757f729..63513d20 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 in the witnesses table +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 From cc25a5288ed5174fb7486a90e717ec5929aa25ef Mon Sep 17 00:00:00 2001 From: LeSiiN <103898231+LeSiiN@users.noreply.github.com> Date: Mon, 4 Dec 2023 19:19:50 +0100 Subject: [PATCH 3/4] Update eventhandlers.lua --- client/eventhandlers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/eventhandlers.lua b/client/eventhandlers.lua index 63513d20..6c7be0ec 100644 --- a/client/eventhandlers.lua +++ b/client/eventhandlers.lua @@ -27,7 +27,7 @@ local function isPedAWitness(witnesses, ped) end ---@param ped number | Ped ID to check ----@return boolean | Returns true if the ped is in the witnesses table +---@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]) From c87375681682d91839580d0cfd8b47b442dbd675 Mon Sep 17 00:00:00 2001 From: MonkeyWhisper <82112471+MonkeyWhisper@users.noreply.github.com> Date: Thu, 21 Dec 2023 00:54:36 -0500 Subject: [PATCH 4/4] Update config.lua --- shared/config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/config.lua b/shared/config.lua index a50432e8..3c6c4dbe 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -43,7 +43,7 @@ Config.Locations = { }, } --- Whitelist Guns that do not send Shooting Alerts +-- Whitelist Guns that do not send shooting alerts Config.WeaponWhitelist = { 'WEAPON_GRENADE', 'WEAPON_BZGAS',