[ANY] Entity AntiSpam
Description
This plugin measures average server framerate every 5 seconds (by default) and does some checks if it drops below a certain value.
The checks it does is basically searching piles of physics collideables that might cause the server to lag. In case such "piles" are found, the plugin takes action on all entities in the pile - like removing or freezing them.
This plugin is intended to prevent malicious players from exploiting the server by dropping too much weapons in a corner (CS:S) or spawning too many tiny phys props (Garry's Mod).
The worst time complexity of every check is O(n**2) where n is the quantity of networkable entities on the server.
That's why the plugin only measures average framerate - so that random lag spikes don't trigger the unnecessary checks.
Configuration
There will be two config files in ../cfg/source-python/ent_antispam/ folder: config.ini and entity_actions.json. Copy them and name the copies config_server.ini and entity_actions_server.json accordingly.
By default the check is issued when the number of processed frames per interval drops below 95% of the reference amount (reference amount is basically server tickrate multiplied by the interval).
You can alter this by setting the min_frames_per_interval's value in config.ini to whatever you like. Say, setting it to 300 will trigger the check every time the plugin detects less than 300 processed frames in 5 seconds.
The plugin also won't check anything for the first level_init_delay seconds of the new map.
Config samples
Syntax: Select all
[frame_measurement]
interval=5
min_frames_per_interval=auto
level_init_delay=10
[piles]
pile_radius=64
max_entities_per_pile=15
Syntax: Select all
[
{
"classname": "weapon_*",
"action": "remove"
},
{
"classname": "prop_physics*",
"action": "freeze"
},
{
"classname": "func_physbox*",
"action": "freeze"
}
]
Server Commands
- ent_antispam stats
Shows the stats like reference framerate and last measured framerate as well as the number of checks triggered and entities removed/frozen. - ent_antispam reload_configs
Reloads plugin config files and restarts frame watching system. Run this after hot-plugging the plugin, because the plugin only starts watching frames on level init.
Demo
- Download the latest development snapshot of this plugin
- Extract contents of the SP-Ent-AntiSpam-master directory to your mod folder
- Add the following line to autoexec.cfg:
sp plugin load ent_antispam