Removing float zeroes on a string - 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: Removing float zeroes on a string (
/showthread.php?tid=526005)
Removing float zeroes on a string -
TheSimpleGuy - 15.07.2014
pawn Код:
new Float:hp, Float:ap,stringy[128];
GetPlayerArmour(playerid, ap);
GetPlayerHealth(playerid, hp);
format(stringy, sizeof(stringy), "%s [%d]\nHP: %f | AP: %f",GetName(playerid),playerid,hp,ap);
SetPlayerChatBubble(playerid, stringy, GetPlayerColor(playerid), 500.0, 1000);
Title ^ ^
Re: Removing float zeroes on a string -
amirab - 15.07.2014
I'm not sure nut maybe this :
PHP код:
format(stringy, sizeof(stringy), "%s [%d]\nHP: %0.6f | AP: %0.6f",GetName(playerid),playerid,hp,ap);
or this one :
PHP код:
format(stringy, sizeof(stringy), "%s [%d]\nHP: %0.4f | AP: %0.4f",GetName(playerid),playerid,hp,ap);
But I'm sure one of them is what you want
Is There Any +REP ?!
Re: Removing float zeroes on a string -
TheSimpleGuy - 15.07.2014
Both... didn't work.
EDIT: Oh wait, I've noticed some FAIL on my script.
BTW thanks for the help,here's your REP+.
Re: Removing float zeroes on a string -
amirab - 15.07.2014
when you use mine what does it show?
and when i put 0.2 it shows with two zeros