Whats the code for killing player?

Discussion in 'Plugin Development' started by BenyTheBuff, Aug 24, 2014.

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

    BenyTheBuff

    Would someone be able to share what the code for killing player is. like player.kill(); ??
     
  2. Offline

    Slash9211

    Code:java
    1. Player p = event.getPlayer();
    2. p.damage(20);
    Thats one way of manually killing a player... To change the damage change the 20. BenyTheBuff
     
  3. Offline

    BenyTheBuff

  4. Offline

    xTigerRebornx

    BenyTheBuff Slash9211 Set their health to 0, that code may not kill them if they have armor/defense
     
  5. Offline

    drtshock

    You should do player.getMaxHealth() instead because the player could have higher than 20 health or just set it to 0.
    CC: BenyTheBuff
     
  6. Offline

    Slash9211

    BenyTheBuff Well, the RPG plugin I'm working on for someone I set the damage up to 300k due to it only doing 1 damage to the player, and I know they can not go over 300k in hp... I made the max up to 250k. So, It works for me rather then checking there hp.
     
  7. Offline

    stormneo7

    Put on armor, damage urself by 20, you wont' die ;)
     
  8. Offline

    teej107

  9. Offline

    BenyTheBuff

    teej107 Yup that works. Cheers
     
Thread Status:
Not open for further replies.

Share This Page