Instructions
Have you ever needed to block a hacker that keeps getting a new IP? Have you ever needed to block an entire country? This plugin will do the job.
You can make ban lists with websites like this.
https://www.countryipblocks.net/country_selection.php
The default ban list path is configs/ipblocks.txt
Code:
# example ban list
1.2.3.4/28
4.5.6.7/18
# network 2
5.6.7.8/31
Here is a quick CIDR tutorial.
1.2.3.4/32 = blocks 1.2.3.4 - 1.2.3.4
1.2.3.4/24 = blocks 1.2.3.0 - 1.2.3.255
1.2.3.4/16 = blocks 1.2.0.0 - 1.2.255.255
1.2.3.4/8 = blocks 1.0.0.0 - 1.255.255.255
You can also use the command cidr_add to add blocks in game that will last until a reboot.
Convars
CreateConVar("cidr_path", "configs/ipblocks.txt", "Path to block list.");
Commands
RegAdminCmd("cidr_reload", Command_Reload, ADMFLAG_BAN, "Clear banlist and reload bans from file.");
RegAdminCmd("cidr_clear", Command_Clear, ADMFLAG_BAN, "Clear banlist.");
RegAdminCmd("cidr_add", Command_Add, ADMFLAG_BAN, "Add CIDR to banlist. Does not last between reboots and does not get added to file.");