Player's Ping in a variable?
#1

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.
Reply
#2

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
Reply
#3

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?
Reply
#4

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.
Reply
#5

Thanks..Repped you both.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)