19.09.2011, 16:43
pawn Код:
public PingKick()
{
if(ServerInfo[MaxPing] != 0)
{
PingPos++; if(PingPos > PING_MAX_EXCEEDS) PingPos = 0;
for(new i=0; i<MAX_PLAYERS; i++)
{
Informacion[i][pPing][PingPos] = GetPlayerPing(i);
if(GetPlayerPing(i) > ServerInfo[MaxPing])
{
if(Informacion[i][PingCount] == 0) Informacion[i][PingTime] = TimeStampxd();
Informacion[i][PingCount]++;
if(TimeStampxd() - Informacion[i][PingTime] > PING_TIMELIMIT)
{
Informacion[i][PingTime] = TimeStampxd();
Informacion[i][PingCount] = 1;
}
else if(Informacion[i][PingCount] >= PING_MAX_EXCEEDS)
{
new Sum, x, string[128];
while (x < PING_MAX_EXCEEDS) {
Sum += Informacion[i][pPing][x];
x++;
}
format(string,sizeof(string),"-Fantasilandia- kickeo a %s por exeder el ping maximo de %d de ping.", PlayerName2(i), ServerInfo[MaxPing] );
SendClientMessageToAll(red,string);
TogglePlayerControllable(i,false);
TextDrawShowForPlayer(i, FondoNegro);
new wea[500];
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(i, PlayerName, MAX_PLAYER_NAME);
new year,month,day; getdate(year, month, day);
new hour,minute,second; gettime(hour,minute,second);
format(wea,sizeof(wea),"{FFFFFF}Disculpa %s, tu has sido Kickeado del servidor!\
\n\n{FFFFFF}Admin: Fantasilandia\
\n{FFFFFF}Razon: Tienes %d de ping y lo maximo es %d.\
\n{FFFFFF}Fecha: %i/%i/%i Hora: %i:%i :%i\
\n\n{FFFFFF}* Porfavor cancela las descargas y vuelve a entrar.",PlayerName,GetPlayerPing(i),ServerInfo[MaxPing], day,month,year, hour, minute, second);
ShowPlayerDialog(i, 8000, DIALOG_STYLE_MSGBOX, " * ", wea, "OK", "");
for(new p = 0; p < MAX_PLAYERS; p++) {
if(IsPlayerConnected(p)) {
PlayerPlaySound(p,1140,0.0,0.0,0.0);}}
Kick(i);
}
}
}
}