|
Hi, I was wondering how to make a check for if the player is in combat in my server so then if they are, they wont be allowed to teleport.
317 PI
I know I need to add a return statement under startTeleport(int int int string) in playerassistant, along with an if statement, but does anybody know the method they checks if the player is in combat?
yes, thank you
I added this and it doesn't work.
Code:if (c.underAttackBy > 0) { c.sendMessage("You cannot teleport out of combat"); return; }
tested this on a server quickly worked fineCode:case 6005: if (c.underAttackBy > 0 || c.underAttackBy2 > 0) { return; } else { c.getPA().startTeleport(3087, 3500, 0, "modern"); } break;
just need to add your send message to tell them they cant tele in combat or w.e
There is no need for a single return in the if because it is a case which stops it later a few lines later due to 'break'.
Could change it to this:
Not a real big deal, just sayin'Code:if (!c.underAttackBy > 0 && !c.underAttackBy2 > 0) { c.getPA().startTeleport(3087, 3500, 0, "modern"); } else { //TODO Message? }
Ok ill try it thanks.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |