SA-MP Forums Archive
Player's Ping in a variable? - 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: Player's Ping in a variable? (/showthread.php?tid=377029)



Player's Ping in a variable? - [HK]Ryder[AN] - 12.09.2012

How to store a player's ping in a variable?

is there some function by which i can do
pawn Код:
new ping;
GetPlayerPing(playerid, ping, sizeof(ping));
or something like that?please tell me.
Thanks.


Re: Player's Ping in a variable? - Kyle - 12.09.2012

You need a variable which saves it in the player id only.

new Ping[MAX_PLAYERS];

Ping[playerid] = GetPlayerPing(playerid);

Use the sa-mp wiki before you guess params of functions, also take out scripting for cash in your sig if you don't know basics.l


Re: Player's Ping in a variable? - [HK]Ryder[AN] - 12.09.2012

When i compile i get
Код:
I:\All\SA-MP Servers\0.3e Win\filterscripts\TD_playerstats.pwn(164) : error 035: argument type mismatch (argument 1)
I:\All\SA-MP Servers\0.3e Win\filterscripts\TD_playerstats.pwn(164) : error 035: argument type mismatch (argument 1)
I:\All\SA-MP Servers\0.3e Win\filterscripts\TD_playerstats.pwn(153) : warning 203: symbol is never used: "pingstring"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
in the code of
pawn Код:
new ping[MAX_PLAYERS], pingstring;
    ping[playerid] = GetPlayerPing(playerid);
    format(pingstring, sizeof(pingstring),"%i", ping[playerid]);//Line 164
Why is this coming?


Re: Player's Ping in a variable? - C00K13M0N$73R - 12.09.2012

pawn Код:
#include <a_samp>
#include <zcmd>
new ping[MAX_PLAYERS],pingstring[124];//PingString needs a size.
   
CMD:myping(playerid,params[])
{
    ping[playerid] = GetPlayerPing(playerid);
    format(pingstring, sizeof(pingstring),"%i", ping[playerid]);//Line 164
SendClientMEssage(plaeyrid,-1,pignrtrinsg);
    return 1;
}
.
Few spelling mistakes IMO.


Re: Player's Ping in a variable? - [HK]Ryder[AN] - 12.09.2012

Thanks..Repped you both.