24.01.2014, 19:11
Title says it all, any way to change this into your script? Since it must be a protection for Bot spawning.
#define MAX_CONNECTIONS_FROM_IP 25 // maximal connections from 1 ip .. u need to define it at ur top of your gamemod
public OnPlayerConnect(playerid)
// MAX IP'S are connecting ..
new connecting_ip[32+1];
GetPlayerIp(playerid,connecting_ip,32);
new num_players_on_ip = GetNumberOfPlayersOnThisIP(connecting_ip);
if(num_players_on_ip > MAX_CONNECTIONS_FROM_IP) {
printf("MAXIPs: Connecting player(%d) exceded %d IP connections from %s.", playerid, MAX_CONNECTIONS_FROM_IP, connecting_ip);
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You have exceeded the max IPs limiit.");
FixedKick(playerid);
return 1;
}
// DONE
Stock of GetNumberOfPlayersOnThisIP
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;
}
Stock of FixedKick
stock FixedKick(playerid) {
KillTimer(kick_gTimer[playerid]);
kick_gTimer[playerid] = SetTimerEx("DelayedKick", 500, false, "i", playerid);
return 1;
}
forward DelayedKick(playerid);
public DelayedKick(playerid) {
if (!IsPlayerConnected(playerid)) return 1;
Kick(playerid);
return 1;
}