Question: SetPlayerHealth - 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: Question: SetPlayerHealth (
/showthread.php?tid=429029)
Question: SetPlayerHealth -
Maxips2 - 07.04.2013
I have noticed that SetPlayerHealth actually rounds down the number, I might be wrong and it only happens to me for some reason.
Can someone please confirm that?
Re: Question: SetPlayerHealth -
HurtLocker - 07.04.2013
What do you mean with "rounds down the number"? If you enter SerPlayerHealth(playerid, 100.0); he goes full health.
Re: Question: SetPlayerHealth -
Basssiiie - 07.04.2013
This is correct. Even though SetPlayerHealth and GetPlayerHealth use floats, they will never use the numbers after the dot. The same is for the armour equivalents. The numbers are always rounded down.
Edit: With "rounded down", he means that if you do SetPlayerHealth(playerid, 50.7), the player health will be 50.0 and GetPlayerHealth will also return 50.0.
Re: Question: SetPlayerHealth -
HurtLocker - 07.04.2013
Quote:
Originally Posted by Basssiiie
With "rounded down", he means that if you do SetPlayerHealth(playerid, 50.7), the player health will be 50.0 and GetPlayerHealth will also return 50.0.
|
Aha, I see.
Re: Question: SetPlayerHealth -
MP2 - 07.04.2013
Could easily be fixed using floatround.
Re: Question: SetPlayerHealth -
Maxips2 - 08.04.2013
Quote:
Originally Posted by Basssiiie
This is correct. Even though SetPlayerHealth and GetPlayerHealth use floats, they will never use the numbers after the dot. The same is for the armour equivalents. The numbers are always rounded down.
Edit: With "rounded down", he means that if you do SetPlayerHealth(playerid, 50.7), the player health will be 50.0 and GetPlayerHealth will also return 50.0.
|
That's what I meant.
Thanks for confirming this!
Re: Question: SetPlayerHealth -
cessil - 08.04.2013
Quote:
Originally Posted by MP2
Could easily be fixed using floatround.
|
you should be able to hook it to just use and return integers