27.02.2012, 14:26
(
Последний раз редактировалось Roperr; 03.06.2012 в 20:18.
)
Functions
This is a simple include which will prevent your server from getting attacked by those pesky join/part bots.
You can also limit how many connections can be made with your server from the same exact IP. This is because some bots do not flood connections, but instead join every few seconds, evading the Anti Flood.
Change the IP_LIMIT if you are affraid of banning brothers, altho unlikely somebody will join with 3 computers.
I believe this will be of much help to other server owners, as it is of help for myself.
I used to use Kick(playerid) and just kick the flooders, but that wouldn't stop them from reconnecting 20 more times, so I've changed it to instantly ban if it identifies these attacks.
This is pretty much secure and won't cause any threat to your regulars being banned. Tested & fully working.
EDIT:
After looking up some more information about these attacks I'd like to provide another simple piece of code that would help you against the attackers that use the samp NPC's.
Add this to the code of OnPlayerConnect.
What this does is check if the NPC connecting has the IP 127.0.0.1, this is the local IP of your server and NPC always connect from that. So if the IP isn't 127.0.0.1, it means the NPC connecting is an attacker's bot.
Have fun, seeya.
Downloads:
2shared link
Pastebin link
This is a simple include which will prevent your server from getting attacked by those pesky join/part bots.
You can also limit how many connections can be made with your server from the same exact IP. This is because some bots do not flood connections, but instead join every few seconds, evading the Anti Flood.
pawn Код:
#define IP_LIMIT 3 // = Max connections from one single IP
#define Time_Limit 3500 // = The time span between connects, adjust it to your own specifications
I believe this will be of much help to other server owners, as it is of help for myself.
I used to use Kick(playerid) and just kick the flooders, but that wouldn't stop them from reconnecting 20 more times, so I've changed it to instantly ban if it identifies these attacks.
This is pretty much secure and won't cause any threat to your regulars being banned. Tested & fully working.
EDIT:
After looking up some more information about these attacks I'd like to provide another simple piece of code that would help you against the attackers that use the samp NPC's.
Add this to the code of OnPlayerConnect.
pawn Код:
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) {
new server_IP[16];
format(server_IP, 16, "127.0.0.1");
if(strcmp(ConnIP,server_IP,true) != 0) {
Ban(playerid); // Ban is the safest thing here, as if you kick, they can still flood you with endless connections
return 0;
}
}
return 1;
}
Have fun, seeya.
Downloads:
2shared link
Pastebin link