Skip to content
Open
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
3 changes: 2 additions & 1 deletion client/alerts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ end
exports('CarJacking', CarJacking)

local function InjuriedPerson()
if InMinigame("pug-paintball", "IsInPaintball") or InMinigame("pug-battleroyale", "IsInBattleRoyale") then return end
local coords = GetEntityCoords(cache.ped)

local dispatchData = {
Expand Down Expand Up @@ -813,4 +814,4 @@ local function BobcatSecurityHeist()

TriggerServerEvent('ps-dispatch:server:notify', dispatchData)
end
exports('BobcatSecurityHeist', BobcatSecurityHeist)
exports('BobcatSecurityHeist', BobcatSecurityHeist)
15 changes: 15 additions & 0 deletions client/eventhandlers.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
local timer = {}

--- Safely checks a boolean export on a started resource.
---@param res string Resource name
---@param exp string Export function name
---@return boolean
function InMinigame(res, exp)
if GetResourceState(res) ~= "started" then return false end

local ok, result = pcall(function()
return exports[res] and exports[res][exp] and exports[res][exp]()
end)

return ok and result == true
end

---@param name string -- The name of the timer
---@param action function -- The function to execute when the timer is up
---@vararg any -- Arguments to pass to the action function
Expand Down Expand Up @@ -39,6 +53,7 @@ local function BlacklistedWeapon(ped)
end

AddEventHandler('CEventGunShot', function(witnesses, ped)
if InMinigame("pug-paintball", "IsInPaintball") or InMinigame("pug-battleroyale", "IsInBattleRoyale") then return end
if IsPedCurrentWeaponSilenced(cache.ped) then return end
if inNoDispatchZone then return end
if BlacklistedWeapon(cache.ped) then return end
Expand Down