SA-MP Forums Archive
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:healthstr[64];
GetPlayerHealth(playeridhealth);
format(strsizeof(str), "Your health is %.5."health);
SendClientMessage(playeridstr); 



Re: float numbers on health - wallen - 16.02.2018

PHP код:
            new Float:hpstring[50];
            
GetPlayerHealth(playerid,hp);
            
format(stringsizeof(string), "%d_%s"floatround(hpfloatround_round), PlayerName[playerid]);
            
SetPlayerName(playeridstring); 



Re: float numbers on health - aoky - 16.02.2018

Quote:
Originally Posted by wallen
Посмотреть сообщение
PHP код:
            new Float:hpstring[50];
            
GetPlayerHealth(playerid,hp);
            
format(stringsizeof(string), "%d_%s"floatround(hpfloatround_round), PlayerName[playerid]);
            
SetPlayerName(playeridstring); 
Why are you rounding the value if you are trying to get a decimal?

Try this:

PHP код:
            new Float:hpstring[50];
            
GetPlayerHealth(playerid,hp);
            
format(stringsizeof(string), "%.5f _ %s"hpPlayerName[playerid]);
            
SetPlayerName(playeridstring); 



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