SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/12/2012, 07:04 AM   #1
DerickClark
High-roller
 
Join Date: Jul 2012
Posts: 1,752
Reputation: 14
Default how to make a ping

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)
DerickClark is offline   Reply With Quote
Old 24/12/2012, 07:27 AM   #2
DaRk_RaiN
Gangsta
 
DaRk_RaiN's Avatar
 
Join Date: Sep 2012
Posts: 973
Reputation: 207
Default Re: how to make a ping

Use y_ini to save the max ping then on the ping kick use a timer or OnPlayerUpdate
pawn Code:
if(GetPlayerPing(playerid)>250)
{
Kick(playerid);
}
DaRk_RaiN is offline   Reply With Quote
Old 24/12/2012, 08:22 AM   #3
Lordzy
High-roller
 
Lordzy's Avatar
 
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,698
Reputation: 1177
Default Re: how to make a ping

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 Code:
#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.
__________________
Currently inactive - I don't play at any SA-MP servers nor work on anything in PAWN for now. The projects that I've done so far in PAWN, which requires updates will be taking some time.
Lordzy is offline   Reply With Quote
Old 24/12/2012, 08:47 AM   #4
DaRk_RaiN
Gangsta
 
DaRk_RaiN's Avatar
 
Join Date: Sep 2012
Posts: 973
Reputation: 207
Default Re: how to make a ping

Quote:
Originally Posted by Lordz™ View Post
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 Code:
#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
DaRk_RaiN is offline   Reply With Quote
Old 24/12/2012, 11:15 AM   #5
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,066
Reputation: 2660
Default Re: how to make a ping

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.
__________________
Vince is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ping BMN Everything and Nothing 7 26/07/2011 08:02 PM
PING Bug or something. Gree Client Support 4 14/03/2011 09:57 AM
Ping TheMarGTA Server Support 4 09/10/2010 02:27 AM
[HELP] MAX PING! riceboi1230 Help Archive 1 10/04/2010 01:04 AM
Sa-Mp Ping TuoNoXz Client Support 1 15/02/2010 03:52 PM


All times are GMT. The time now is 11:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.