float numbers on health - 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: float numbers on health (
/showthread.php?tid=649879)
float numbers on health -
wallen - 16.02.2018
Well i just wanted to do something like 100.00000 and like, i already tried with %.5f but then the health wont get recognized and will be stuck at 0
Re: float numbers on health -
aoky - 16.02.2018
Can you show the code?
Make sure when you are getting the players health you are doing something along the lines of this:
PHP код:
new Float:health, str[64];
GetPlayerHealth(playerid, health);
format(str, sizeof(str), "Your health is %.5.", health);
SendClientMessage(playerid, str);
Re: float numbers on health -
wallen - 16.02.2018
PHP код:
new Float:hp, string[50];
GetPlayerHealth(playerid,hp);
format(string, sizeof(string), "%d_%s", floatround(hp, floatround_round), PlayerName[playerid]);
SetPlayerName(playerid, string);
Re: float numbers on health -
aoky - 16.02.2018
Quote:
Originally Posted by wallen
PHP код:
new Float:hp, string[50];
GetPlayerHealth(playerid,hp);
format(string, sizeof(string), "%d_%s", floatround(hp, floatround_round), PlayerName[playerid]);
SetPlayerName(playerid, string);
|
Why are you rounding the value if you are trying to get a decimal?
Try this:
PHP код:
new Float:hp, string[50];
GetPlayerHealth(playerid,hp);
format(string, sizeof(string), "%.5f _ %s", hp, PlayerName[playerid]);
SetPlayerName(playerid, string);
Re: float numbers on health -
wallen - 16.02.2018
Damn na it didnt worked, but i somehow managed to fix it, thanks for your time appreaciated