30.01.2016, 08:57
Quote:
Why are you create variables and send message for all players in a cycle? Here is my version ^-^
PHP Code:
|
PHP Code:
@__CheckPlayerPing();
@__CheckPlayerPing()
{
static const
fmt_str[] = "[Server] %s has been kicked. Reason: {00FFFF}High Ping(%d / "#MAX_PLAYER_PING")";
static
str[sizeof fmt_str -2*3+(MAX_PLAYER_NAME+1)+5];
#if defined foreach
foreach (new i: Player)
#else
for (new i = GetPlayerPoolSize(), ping; --i != -1; ) if (GetPlayerName(i, str, MAX_PLAYER_NAME + 1) != 0)
#endif
{
if (((ping = GetPlayerPing(i)) > MAX_PLAYER_PING) && (ping != 65535))
{
format(i, sizeof str, fmt_str, ping);
Kick(i);
}
}
SendClientMessageToAll(-1, str);
}