Quote:
Originally Posted by RxErT
Ping Kicker
Information:
This snippet is all about kicking player, whose having high ping and lagging hard.
-script is editable.
Code:
PHP код:
#define Ping_Kicker "SNIPPET"
/* Includes */
#include <a_samp>
/* Defines */
new MAX_PING = 300; //Changeable
/* Beginning */
public OnPlayerUpdate(playerid)
{
new string[120],name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name,sizeof(name));
if(GetPlayerPing(playerid) >= MAX_PING) return Kick(playerid);
format(string,sizeof(string),"%s(%i) has been kicked for High ping! [MAX: %s]",name,playerid,MAX_PING);
SendClientMessageToAll(-1,string);
return 1;
}
- Not having any bug, if anyone has any trouble with running the script feel free to contact me.
|
That is actually going to spam your server with messages of players getting kicked with maximum ping warnings when they are still below the maximum ping limit. On top of that, when the players are actually above the maximum limit, other players in the server won't even get the message that the player was kicked. In addition, doing all that under OnPlayerUpdate is a very bad idea.
The only thing you are doing right in that piece of code the checking if the ping exceeds the maximum ping limit and kicking the player. The messages and the code placement is all wrong.