Server Warnings
#5

pawn Код:
forward PingKick();
public PingKick()
{
    if(ServerInfo[MaxPing] != 0)
    {

        for(new i=0; i<MAX_PLAYERS; i++)
        {
            AccInfo[i][pPing] = GetPlayerPing(i);

            if(GetPlayerPing(i) > ServerInfo[MaxPing])
            {
                if(AccInfo[i][PingCount] == 0) AccInfo[i][PingTime] = TimeStamp();

                AccInfo[i][PingCount]++;
                if(TimeStamp() - AccInfo[i][PingTime] > PING_TIMELIMIT)
                {
                    AccInfo[i][PingTime] = TimeStamp();
                    AccInfo[i][PingCount] = 1;
                }
                else if(AccInfo[i][PingCount] >= PING_MAX_EXCEEDS)
                {
                    new Sum, Average, x, string[128];
                    while (x < PING_MAX_EXCEEDS) {
                        Sum += AccInfo[i][pPing][x];
                        x++;
                    }
                    Average = (Sum / PING_MAX_EXCEEDS);
                    format(string,sizeof(string),"%s has been kicked from the server. (Reason: High Ping (%d) | Average (%d) | Max Allowed (%d) )", PlayerName2(i), GetPlayerPing(i), Average, ServerInfo[MaxPing] );
                    SendClientMessageToAll(grey,string);
                    Kick(i);
                }
            }
        }
    }
}
Reply


Messages In This Thread
Server Warnings - by martin3644 - 14.01.2013, 13:05
Re: Server Warnings - by martin3644 - 14.01.2013, 14:00
Re: Server Warnings - by martin3644 - 14.01.2013, 21:51
Re: Server Warnings - by u3ber - 14.01.2013, 21:53
Re : Server Warnings - by [HRD]Mar1 - 14.01.2013, 22:17
Re: Re : Server Warnings - by martin3644 - 15.01.2013, 15:34
Re: Server Warnings - by ]Rafaellos[ - 15.01.2013, 16:20

Forum Jump:


Users browsing this thread: 2 Guest(s)