Jump to content

Problems with player health/max health


dam034

Recommended Posts

Dear users,

I'm trying to set via scripting the player's max health and health.

I execute these commands:

setPedStat(me, 24, 1000)
setElementHealth(me, 1000)

 

But when I try to retrieve my ped's current health, I get 200, also if the health's progress bar is full.

 

Is this a bug? Or I done a mistake?

 

Thanks

Link to comment

4.31 is the gradient of the graph. I.e., the amount of stat difference between max health of 100 (stat value 569) and 200 (stat value 100) is 431. Difference between 100 and 200 is 100. 431/100 = 4.31.

For every 4.31 units of increase in stat above the default of 569, you get extra 1 health point above 100.

 

Shoulda paid attention in math class :)

Edited by MrTasty
  • Haha 1
Link to comment
4 hours ago, dam034 said:

Thanks for the explanation. :)

I have another question: why this?


return math.max(1, maxhealth)

 

Thanks

As stated in the wiki page: 

-- Return the max health. Make sure it can't be below 1

It means that if the value of 'maxhealth' is negative it will always return 1. Basically it checks to see which of the two values is bigger than the other and always returns the bigger one :)

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...