// Author: K_POLAND #include #define MAX_SECONDS 10 #define MAX_PING 666 new Sekundy[200]; public OnFilterScriptInit() { SetTimer("SprawdzPing", 1000, true); return 1; } public OnPlayerConnect(playerid) { Sekundy[playerid] = 0; return 1; } forward SprawdzPing(); public SprawdzPing() { new IloscOsob, Ping, s[256], name[50]; for(new p = 0; p < GetMaxPlayers(); p++) { if(IsPlayerConnected(p)==1) { IloscOsob++; Ping += GetPlayerPing(p); } } Ping /= IloscOsob; for(new p = 0; p < GetMaxPlayers(); p++) { if(IsPlayerConnected(p)==1) { if(GetPlayerPing(p) >= Ping + MAX_PING) { Sekundy[p]++; } if(Sekundy[p] == MAX_SECONDS) { GetPlayerName(p, name, sizeof name); format(s, sizeof s, "%s (ID: %d) is kicked. Reason: a lot of ping.", name, p); SendClientMessageToAll(0xAA3333AA, s); Kick(p); } } else if(GetPlayerPing(p) < Ping + MAX_PING) { if(Sekundy[p] != 0) { Sekundy[p]--; } } } return 1; }