SA-MP Forums Archive
[duvida] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [duvida] (/showthread.php?tid=310464)



[duvida] - Cristhian - 12.01.2012

alguйm sabe como tirar o "0.000000" de uma float ?
por exemplo:
pawn Код:
new Float:vida = 10;
format(string, sizeof(string), "Float vida: %f", vida);
SendClientMessage(playerid, -1, string);
no caso vai aparecer 10.00000
espero que entendam o que quero dizer...


Re: [duvida] - Dolby - 12.01.2012

pawn Код:
new Float:vida = 10;
format(string, sizeof(string), "Float vida: %.2f", vida);
SendClientMessage(playerid, -1, string);
tente assim.


Re: [duvida] - Cristhian - 12.01.2012

Obrigado.
no final, meu cуdigo iria ficar assim:
pawn Код:
new Float:vida = 10;
format(string, sizeof(string), "Float vida: %.0f", vida);//sem nenhum .000 :D
SendClientMessage(playerid, -1, string);
(te daria rep+, mas jб te dei alguma vez .-.)


Re: [duvida] - Ricop522 - 12.01.2012

Nгo precisa disso
Use a funзгo floatround
pawn Код:
new Float:vida = 10;
format(string, sizeof(string), "Float vida: %f", floatround(vida));
SendClientMessage(playerid, -1, string);