Thread: Incombat blocks teleport?

Results 1 to 9 of 9
  1. #1 Incombat blocks teleport? 
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    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?
     

  2. #2  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    Quote Originally Posted by thenoobiam View Post
    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?
    check this
    Code:
    	public void putInCombat(final int attacker) {
    does that help you?
     

  3. #3  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    yes, thank you
     

  4. #4  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    I added this and it doesn't work.

    Code:
    if (c.underAttackBy > 0) {
    c.sendMessage("You cannot teleport out of combat");
    return;
    }
     

  5. #5  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    Quote Originally Posted by thenoobiam View Post
    I added this and it doesn't work.

    Code:
    if (c.underAttackBy > 0) {
    c.sendMessage("You cannot teleport out of combat");
    return;
    }
    could you not use
    Code:
    if (System.currentTimeMillis() - logoutDelay > 10000) {
    seen as that would stop you logging out surely it would also stop you teleing aswell
     

  6. #6  
    Donator

    Join Date
    Oct 2014
    Posts
    587
    Thanks given
    29
    Thanks received
    76
    Rep Power
    26
    Quote Originally Posted by nemoige View Post
    could you not use
    Code:
    if (System.currentTimeMillis() - logoutDelay > 10000) {
    seen as that would stop you logging out surely it would also stop you teleing aswell
    Possible, but OP wants to stop people from teleporting in combat.
     

  7. #7  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    Code:
    		case 6005:
    		if (c.underAttackBy > 0 || c.underAttackBy2 > 0) {
    			return;
    		} else {
    			c.getPA().startTeleport(3087, 3500, 0, "modern");
    			}
    			break;
    tested this on a server quickly worked fine
    just need to add your send message to tell them they cant tele in combat or w.e
     

  8. #8  
    Donator

    Join Date
    Oct 2014
    Posts
    587
    Thanks given
    29
    Thanks received
    76
    Rep Power
    26
    Quote Originally Posted by nemoige View Post
    Code:
    		case 6005:
    		if (c.underAttackBy > 0 || c.underAttackBy2 > 0) {
    			return;
    		} else {
    			c.getPA().startTeleport(3087, 3500, 0, "modern");
    			}
    			break;
    tested this on a server quickly worked fine
    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:

    Code:
    if (!c.underAttackBy > 0 && !c.underAttackBy2 > 0) {
                            c.getPA().startTeleport(3087, 3500, 0, "modern");
    } else {
    //TODO Message?
    }
    Not a real big deal, just sayin'
     

  9. #9  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Ok ill try it thanks.
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Blocking Teleports For A Certain Area - 718
    By MomentumRSPS in forum Help
    Replies: 12
    Last Post: 06-03-2013, 09:21 PM
  2. PI Block teleport on Tut island Help
    By RsTurm in forum Help
    Replies: 3
    Last Post: 05-24-2012, 07:17 AM
  3. Block Teleport Commands in Wild
    By fl3xin in forum Requests
    Replies: 1
    Last Post: 10-25-2009, 07:13 AM
  4. Replies: 2
    Last Post: 07-16-2009, 01:12 PM
  5. Replies: 2
    Last Post: 07-16-2009, 12:59 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •