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:health, str[64];
GetPlayerHealth(playerid, health);
format(str, sizeof(str), "Your health is %.5.", health);
SendClientMessage(playerid, str); 
Reply
#3

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

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); 
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)