Skip to content
Open
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
22 changes: 18 additions & 4 deletions [admin]/security/players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,19 @@ addEventHandler("onVehicleExplode", root, clientCreateVehicleExplosion);
-- thresholds need to be adjusted for your need and actions taken!
setTimer(function()
for uPlayer, iCounter in pairs(tblPlayerProjectiles) do
if(iCounter >= iPlayerProjectileThreshold) then
if(isElement(uPlayer) and iCounter >= iPlayerProjectileThreshold) then
logViolation(uPlayer, "Exceeded projectile threshold "..tostring(iPlayerProjectileThreshold).." - Count: "..tostring(iCounter));
end
end

for uPlayer, iCounter in pairs(tblRegularExplosions) do
if(iCounter >= iRegularExplosionThreshold) then
if(isElement(uPlayer) and iCounter >= iRegularExplosionThreshold) then
logViolation(uPlayer, "Exceeded regular explosions threshold "..tostring(iRegularExplosionThreshold).." - Count: "..tostring(iCounter));
end
end

for uPlayer, iCounter in pairs(tblVehicleExplosions) do
if(iCounter >= iVehicleExplosionThreshold) then
if(isElement(uPlayer) and iCounter >= iVehicleExplosionThreshold) then
logViolation(uPlayer, "Exceeded vehicle explosions threshold "..tostring(iVehicleExplosionThreshold).." - Count: "..tostring(iCounter));
end
end
Expand All @@ -154,4 +154,18 @@ setTimer(function()
tblRegularExplosions = {};
tblVehicleExplosions = {};

end, iExplosionCheckInterval, 0);
end, iExplosionCheckInterval, 0);

addEventHandler("onPlayerQuit", root, function()
if(tblPlayerProjectiles[source]) then
tblPlayerProjectiles[source] = nil;
end

if(tblRegularExplosions[source]) then
tblRegularExplosions[source] = nil;
end

if(tblVehicleExplosions[source]) then
tblVehicleExplosions[source] = nil;
end
end);