SA-MP Forums Archive
Exact player health (Text Draw) - 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: Exact player health (Text Draw) (/showthread.php?tid=660272)



Exact player health (Text Draw) - SiNaGaMeR - 29.10.2018

Hello there
I want to do something to get the EXACT player's health
I did something like this:
PHP код:
                      new Float:Health;
                      
GetPlayerHealth(playeridHealth);
                      new 
pingss[128];
                      
format(pingsssizeof(pingss), "%.2f"Health);
                      
PlayerTextDrawSetString(playeridHP_TD[playerid], pingss); 
but it was only show player health e.g. (100.00 or 85.00 or 44.00) but I want a script to show EXACT player health e.g. 85.56 or 65.10 or 44.98 .. and like these..
If you know what should I do tell me...


Re: Exact player health (Text Draw) - v1k1nG - 29.10.2018

You created a float variable. If health is actually a decimal number you will see a decimal number, either you will see an integer.
In my personal experience I never got a player's health resulting in a decimal number, though GetPlayerHealth requires a float variable to work correctly.


Re: Exact player health (Text Draw) - v1k1nG - 29.10.2018

Quote:
Originally Posted by ******
Посмотреть сообщение
Health isn't actually stored as a float internally (so don't ask me why it is returned as one), so there isn't an "exact" health.
Probably because of custom health scripts


Re: Exact player health (Text Draw) - TheToretto - 29.10.2018

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
Probably because of custom health scripts
He's talking about the native itself.


Re: Exact player health (Text Draw) - SiNaGaMeR - 30.10.2018

TY All