Solved .getHealth question

Discussion in 'Plugin Development' started by nuno1212sss, Mar 24, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    nuno1212sss

    I made a player have a healthScale of 40.
    Two questions:
    Why doesn't player.setHealth(40) allow me to do that? wtf
    And why does player.getHealth return the health from 0-20 and not from 0-40.
    I know .setMaxHealth allow me to do player.setHealth(40) but it's all bugged and fuck xD
    Tnks for the help
     
  2. Offline

    SuchSwegMuchWow

    @nuno1212sss I believe that setHealth and setMaxHealth are doubles, so you have to do
    Code:
    player.setHealth(20D)
     
  3. Offline

    nuno1212sss

    @SuchSwegMuchWow Yes, I know, that isn't the problem. I just forgot the D after xD
     
  4. Offline

    sgavster

    @nuno1212sss Why would it do from 0 - 40? 0 - 20 because the player has 20 health, or 10 hearts.
     
  5. @sgavster There's a setMaxHealth method for a reason.
     
  6. Offline

    sgavster

    @CodePlaysMinecraft He didn't state that he was using that.. You don't have to be rude about it, had no idea.
     
  7. Offline

    nuno1212sss

    Fixed the problem.
    Was not a problem at all. Just a conflict of mine. Sorry.
     
  8. Offline

    nverdier

  9. @sgavster I wasn't being rude. You said
    and the setMaxHealth() methods sets the max health for the player. The original health is 20, but he said he wanted to set it to something, like 40.
    So that's why I was just saying that there's a method for a reason. To set a player's max health.
     
  10. Offline

    kaif21

    How to get health :(
     
  11. @kaif21 1. Please make another thread, as this thread is already solved.
    2. Player.getHealth();
     
Thread Status:
Not open for further replies.

Share This Page