how to make a ping - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread:  how to make a ping (
/showthread.php?tid=401813)
 
how to make a ping - 
DerickClark -  24.12.2012
how to make a /setping  how like i pick 250 Admin Derick Has set ping to 250
if they ping go high Your ping is high (Kicked)
Re: how to make a ping - 
DaRk_RaiN -  24.12.2012
Use y_ini to save the max ping then on the ping kick use a timer or OnPlayerUpdate
pawn Код:
if(GetPlayerPing(playerid)>250)
{
Kick(playerid);
}
 
Re: how to make a ping - 
Lordzy -  24.12.2012
You don't need to use y_ini or any file systems for saving the maximum ping of the server. A simple define is enough or a variable.
pawn Код:
#define MAX_PING 54321  //Add your value.
public OnFilterScriptInit()
{
 SetTimer("DetectPing", 2000, true); //A timer would be better in handling ping detection.
 return 1;
}
forward DetectPing();
public DetectPing()
{
 for(new i; i< GetMaxPlayers(); i++)
 {
  if(!IsPlayerConnected(i)); continue;
  if(GetPlayerPing(playerid) >= MAX_PING) return Kick(playerid);
 }
 return 1;
}
 
Btw, you can't set anyone's ping atm.
Re: how to make a ping - 
DaRk_RaiN -  24.12.2012
Quote:
					Originally Posted by  Lordz™
 
 
You don't need to use y_ini or any file systems for saving the maximum ping of the server. A simple define is enough or a variable. 
pawn Код: 
#define MAX_PING 54321  //Add your value.
  public OnFilterScriptInit() {  SetTimer("DetectPing", 2000, true); //A timer would be better in handling ping detection.  return 1; } forward DetectPing();
  public DetectPing() {  for(new i; i< GetMaxPlayers(); i++)  {   if(!IsPlayerConnected(i)); continue;   if(GetPlayerPing(playerid) >= MAX_PING) return Kick(playerid);  }  return 1; }  
 
Btw, you can't set anyone's ping atm.  
 | 
 He said ingame set xD
Re: how to make a ping - 
Vince -  24.12.2012
Just search for a decent pingkicker filterscript that samples the player's ping over time. A player that usually never lags may suddenly experience a short lagspike, resulting in him getting kicked. Not fun.