Take certain amount of damage away

Discussion in 'Plugin Development' started by XKnucklesX, Jul 11, 2013.

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

    XKnucklesX

    I have created a guns plugin without textures yet.

    I have a gun and would like it to always take a certain amount of damage since I want the guns to be better and worse then others could you please post the line
     
  2. Offline

    Eats_Rainbows

    Code:
    p.setHealth();
     
  3. Offline

    XKnucklesX

    But it also depends if the player has full or half of full. Since if they have full it takes away 5 they survive but the other way they die

    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  4. Simple java programming bro.
    Code:
    if (p.getHealth() == 20){
    p.setHealth(10)
    { else if (p.getHealth() < 20){
    p.setHealth(0)
    }
     
  5. Offline

    XKnucklesX

    You wrote it wrong since if they have 20 it takes 10 buit if they have lower it culd take up to 19
     
  6. Offline

    Ar7ific1al

    Not quite sure what you want here, but...

    If you want it to do 5 damage if they have >10 health, and do 10 damage if they have <= 10 health....
    Code:java
    1. if (player.getHealth() > 10) {
    2. player.damage(5);
    3. }
    4. else {
    5. player.damage(10);
    6. }
     
Thread Status:
Not open for further replies.

Share This Page