SA-MP Forums Archive
/stats - 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: /stats (/showthread.php?tid=565347)



/stats - _GHT_MarK445 - 26.02.2015

Hi,

in my /stats command i am using information about showing an health points to the player, i have it like this:


Код:
new Float:pHP;
GetPlayerHealth(playerid,pHP);
format(string,sizeof string,"HP Amount: %d",pHP);
strcat(str, string);
ShowPlayerDialog... and stuff
and when i type /stats it is showing me really over 10 milion hp, which is not correct.

Off course, i have just 100hp, so why it is not showing the correct number? Thanks.


Re: /stats - Glad2BeHere - 26.02.2015

%d to %f

( pHP = float = %f )


Re: /stats - SweetRP - 26.02.2015

Can you please give your full /stats command?

Glad2BeHere is right, health need to be float (f%) not int (%d).


Re: /stats - iMFear - 26.02.2015

pHP = Float variable.

try: %f.


Re: /stats - _GHT_MarK445 - 26.02.2015

Thank you both Glad2BeHere and Sweet, it helped a lot. REP+

iMFear: %i is the same thing as %d.


Re: /stats - Schneider - 26.02.2015

Quote:
Originally Posted by _GHT_MarK445
Посмотреть сообщение
iMFear: %i is the same thing as %d.
Right for output, wrong for input.


Re: /stats - _GHT_MarK445 - 26.02.2015

I am using just output, so that is why i told that.