Question: SetPlayerHealth
#1

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

What do you mean with "rounds down the number"? If you enter SerPlayerHealth(playerid, 100.0); he goes full health.
Reply
#3

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.
Reply
#4

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.
Reply
#5

Could easily be fixed using floatround.
Reply
#6

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

Quote:
Originally Posted by MP2
Посмотреть сообщение
Could easily be fixed using floatround.
you should be able to hook it to just use and return integers
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)