float numbers on health
#1

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
Reply
#2

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); 
Reply
#3

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

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); 
Reply
#5

Damn na it didnt worked, but i somehow managed to fix it, thanks for your time appreaciated
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)