Don’t use this to try kicking/cleaning people that build laggy contraptions. This isn’t made for that and isn’t reliable enough for that. This is for banning asshole 12-year-olds that spam bridges and drop server fps to areas below 5
This script uses the cleanup library and toolgun/physgun hooks to monitor created entities, such as those from the toolgun or any type of prop spawning so that if the server’s frame time goes above a specified value for a specified number of frames, the player’s entities will be cleaned up and can be optionally kicked and banned.
There are some configurations in the script. I’ll list them.
local Should_ban = true --Should ban?
local Should_kick = true --Should Kick?
local Ban_time = 60 --minutes. 0 for permanent
local Log_refreshtime = 1.5 --How long in seconds of no lag until log resets
local Ticks_of_lag = 5 --How many ticks of lag before the server takes action
local Length_of_lag = .2 --How much time a frame is held to be considered lag. .2 is 5 fps
-Works with any entity that can be undone.
-Works with unfreezing clumps of entities.
-Logs spawning from multiple players during lag so if the lag from one isn’t eliminated, it can punish the other too.
Note Players are only logged when the server isn’t lagging, so spawning something while the server is lagging won’t punish you.
Also Note Every log reset time, the log resets. So if you spawn something and the server lags however long the log delay is later. You won’t be punished.
-Cleans up lag inflictor’s props and optionally bans or kicks them.
Known Working Situations
-I spawned 200 unfrozen wooden chairs in each other and the script worked
-Spammed bridges got detected and cleaned.
-Spamming random citizen ragdolls triggers this too.
Instructions - Put Nolag folder in “garrysmod/garrysmod/addons” and make sure to navigate to the lua file and configure it if you want
This is currently a beta and has been tested a lot, but if there are any problems or bugs, please describe them.
Note* When it says “Cleaned Up Everything”, it means everything that player owns is cleaned, not the whole map.