Jump to content

Player health in %


Karuzo

Recommended Posts

getElementHealth() returns a float between 0-1000. So you'll want to divide that by 10 and probably want to use math.ceil since you're gonna get results of 75.4571 etc. But decimal values shouldn't be a problem when working with progress bars, only if you're displaying this number somewhere, it'd be a PITA to read 85.7941.

getElementHealth() 
math.ceil 

Edited by Guest
Link to comment
Maths!
  
Health = 50 
Health =  tonumber (Health) / 100 * 100 
print ( Health.."%") -- 50 % 
  

As much as I know total health should be 100 or check it by yourself :P

Health =  tonumber (Health) / 100 * 100 <= realy? :3 why even need /100 * 100 lol just useless stuff

Link to comment
Maths!
  
Health = 50 
Health =  tonumber (Health) / 100 * 100 
print ( Health.."%") -- 50 % 
  

As much as I know total health should be 100 or check it by yourself :P

Health =  tonumber (Health) / 100 * 100 <= realy? :3 why even need /100 * 100 lol just useless stuff

Lol? Do you even know what you are talking about? Let's say I have 100HP. 100 / 100 = 1, so I have 1%?

Link to comment
getElementHealth() returns a float between 0-1000. So you'll want to divide that by 10 and probably want to use math.ceil since you're gonna get results of 75.4571 etc. But decimal values shouldn't be a problem when working with progress bars, only if you're displaying this number somewhere, it'd be a PITA to read 85.7941.
getElementHealth() 
math.ceil 

Wrong, the player health is between 0 and 100, if you have the health stat, it can be maximum 200%, the vehicle health is between 0 and 1000.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...