#1

Problems encountered (description): Can not enter the server because ping picture below
Код:
//Anti High Ping
	//--------------------------------------------------------------------------
	foreach(new i: Player)
	{
		if(GetPlayerPing(i) > ServerInfo[MaxPing])
		{
		 	FormatMSG(i, COLOR_ULTRARED, "%s(%d) {FFFF00}has been auto-kicked for having a high ping.[{FF0000}%d/%d{FFFF00}]", PlayerName(i), i, GetPlayerPing(i), ServerInfo[MaxPing]);
		 	//------------------------------------------------------------------
		 	eLog[0] = EOS; format(eLog, sizeof(eLog), "%s has been auto-kicked for having a high ping.[%d/%d]", PlayerName(i), GetPlayerPing(i), ServerInfo[MaxPing]), SendLog(eLog), KickEx(i);
		}
	}
	//--------------------------------------------------------------------------
IMG/ http://i.imgur.com/KlUTw0O.png
Reply
#2

What is your ServerInfo[MaxPing]?
Reply
#3

When you join the server the ping says 65535, which is the reason you're getting kicked.

Set a timer to check it every * seconds when they spawn.
https://sampwiki.blast.hk/wiki/GetPlayerPing
Reply
#4

This is not a good way to implement a ping kicker system. One spike or invalid value (as said above) and the player is out. This is a very good way to lose players very quickly. To build a decent ping kicker you need to take several samples and calculate the average of these samples. The more samples the better. I would say at least 10, but maybe more.

PHP код:
CalculateAverage(const pieces[], totalAmount sizeof pieces)
{
    new 
sum 0;
    
    for(new 
itotalAmounti++)
    {
        
sum += pieces[i];
    }
    
    return 
sum totalAmount;

Reply
#5

As mentioned above, it is best to use timers for an effective ping system.
I would suggest setting a timer every 30 seconds, and if the ping is higher than your server's max ping implement 1... Until the guy gets 15 warnings, then kick him out.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)