05.07.2012, 04:43
Just something I was thinking of... Try in OnPlayerConnect well.. Add this:
For more help, visit: https://sampwiki.blast.hk/wiki/Category:..._Documentation - Scripting Help.
For more help specifically with this (What I just gave.).
Visit:
pawn Code:
#define MAX_PING_ALLOWED 1000 // Or whatever you want it to be.
public OnPlayerConnect(playerid)
{
if(GetPlayerPing(playerid) >= MAX_PING_ALLOWED)
{
SendClientMessage(playerid, 0xFFFFFFAA, "You have been kicked. Reason: Max Ping.");
Kick(playerid);
}
return 1;
}
// OR:
// Add to OnGameModeInit:
SetTimer("PingCheckTimer", 5000, true); // 5000 == 5 Seconds. True == Repeating Timer. False == Non-Repeating Timer. // Meaning it will repeat the check, every 5 seconds.
// And now the Checker.
#define MAX_PING_ALLOWED 1000 // Or whatever you want it to be.
forward PingCheckTimer(playerid);
public PingCheckTimer(playerid)
{
// Kick players with a high ping
if(GetPlayerPing(playerid) >= MAX_PING_ALLOWED)
{
SendClientMessage(playerid, 0xFFFFFFAA, "You have been kicked. Reason: Max Ping."); // 0xFFFFFFAA == White.
Kick(playerid);
}
return 1;
}
For more help specifically with this (What I just gave.).
Visit:
- https://sampwiki.blast.hk/wiki/GetPlayerPing - It is help with GetPlayerPing.
- https://sampwiki.blast.hk/wiki/GetPlayerIp - Help with GetPlayerIp.
- https://sampwiki.blast.hk/wiki/SetTimer - Help with SetTimer.

