01.01.2014, 12:27
Hello, do you know any good method to prevent this shitty bots from connecting to the server?
// under onPlayerConnect
new num_players_on_ip = GetNumberOfPlayersOnThisIP(connecting_ip);
if(num_players_on_ip > MAX_CONNECTIONS_FROM_IP)
{
// banning
}
stock GetNumberOfPlayersOnThisIP(test_ip[])
{
new against_ip[32+1];
new x = 0;
new ip_count = 0;
for(x=0; x<MAX_PLAYERS; x++) {
if(IsPlayerConnected(x)) {
GetPlayerIp(x,against_ip,32);
if(!strcmp(against_ip,test_ip)) ip_count++;
}
}
return ip_count;
}