15.09.2014, 15:19
Ok, so i created this Anti-Bots Flood protection, its an really easy system, but cool.
I've created it within 5 minutes.
An nice, protection against those wants to flood your server.
I've created it within 5 minutes.
pawn Код:
// Anti-Flood
#include <a_samp>
#define MAX_CONNECT 1
new UserMaxConnect[MAX_PLAYERS];
new ip[30];
forward CheckIfFlood(playerid);
public CheckIfFlood(playerid)
{
new ips[MAX_PLAYERS];
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerIp(playerid, ips, sizeof(ips));
if(!strcmp(ip, ips, false))
{
UserMaxConnect[playerid]++;
}
}
if(UserMaxConnect[playerid] > MAX_CONNECT)
{
Ban(playerid);
}
return 1;
}
public OnPlayerConnect(playerid)
{
GetPlayerIp(playerid, ip, sizeof(ip));
UserMaxConnect[playerid] = 0;
SetTimerEx("CheckIfFlood", 1000, true, "i", playerid);
return 1;
}
//Anti bots - Flood Protection
// Nu se pot connecta mai mult de numarul de la MAX_CONNECT de pe acelasi IP