Thread: pi - combat required commands

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 pi - combat required commands 
    Registered Member Herbb's Avatar
    Join Date
    May 2013
    Age
    30
    Posts
    91
    Thanks given
    1
    Thanks received
    2
    Rep Power
    36
    Hello rune-server, i'd like to ask how i might go about making a command to teleport somewhere require a certain combat level to do so.

    i currently have this with no errors but it still let you teleport.

    if (playerCommand.equals("train") && (c.playerRights >= 0)) {
    if (c.getCombatLevel() < 50) {
    c.getPA().startTeleport(2683, 3725, 0, "modern");
    c.sendMessage("You need a combat level of 50 to teleport here.");
    c.sendMessage("You can train here!");
    }
    }

    i've been messing with the code a bit trying different things, would anyone mind helping? if you can't then just leave, no flaming please
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Jan 2009
    Posts
    1,319
    Thanks given
    71
    Thanks received
    105
    Rep Power
    334
    Code:
    if (playerCommand.equals("train") && (c.playerRights >= 0)) {
    	if (c.getCombatLevel() < 50) {
    		c.getPA().startTeleport(2683, 3725, 0, "modern");
    		c.sendMessage("You need a combat level of 50 to teleport here.");
    		c.sendMessage("You can train here!");
    		return;
    	}
    }
    Attached image
    Reply With Quote  
     

  3. #3  
    Registered Member Herbb's Avatar
    Join Date
    May 2013
    Age
    30
    Posts
    91
    Thanks given
    1
    Thanks received
    2
    Rep Power
    36
    That's what i have. it still let's any level teleport
    Reply With Quote  
     

  4. #4  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Paste the function

    Code:
    c.getCombatLevel()
    Reply With Quote  
     

  5. #5  
    Registered Member
    Zivik's Avatar
    Join Date
    Oct 2007
    Age
    28
    Posts
    4,421
    Thanks given
    891
    Thanks received
    1,527
    Rep Power
    3285
    Quote Originally Posted by Jason View Post
    Paste the function

    Code:
    c.getCombatLevel()
    He forgot the return; Which the guy above had the fix for.

    Assuming the method is proper as you're wanting to check, then it's fine with that fix.
    Reply With Quote  
     

  6. #6  
    Registered Member Herbb's Avatar
    Join Date
    May 2013
    Age
    30
    Posts
    91
    Thanks given
    1
    Thanks received
    2
    Rep Power
    36
    Still not working, and i did try putting a return in but it didn't help just gave me mad errors
    Reply With Quote  
     

  7. #7  
    Registered Member
    Zivik's Avatar
    Join Date
    Oct 2007
    Age
    28
    Posts
    4,421
    Thanks given
    891
    Thanks received
    1,527
    Rep Power
    3285
    Quote Originally Posted by Herbb View Post
    Still not working, and i did try putting a return in but it didn't help just gave me mad errors
    Post the entire code again, and include the method "getCombat".
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Jan 2014
    Posts
    308
    Thanks given
    115
    Thanks received
    57
    Rep Power
    0
    Code:
    if (c.getCombatLevel() < 50) {
    should be
    Code:
    if (c.getCombatLevel() > 50) {
    Spoiler for Charlie Sheen ft Lil B:

    Every derep I ever got was from a butthurt bitch I shut down.
    Reply With Quote  
     

  9. #9  
    Registered Member Herbb's Avatar
    Join Date
    May 2013
    Age
    30
    Posts
    91
    Thanks given
    1
    Thanks received
    2
    Rep Power
    36
    Well it's still giving me errors when trying to add this..

    and this is my code..

    if (playerCommand.equals("home") && (c.playerRights >= 0)) {
    if (c.getCombat() >= 3) {
    c.getPA().startTeleport(2222, 3219, 0, "modern");
    c.sendMessage("You need a combat level of 3 to teleport here.");
    c.sendMessage("Welcome to the newcomer Home area!");
    return;
    }
    }
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Oct 2014
    Posts
    6
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    if (playerCommand.equals("train")) {
    if (c.getCombatLevel() < 50) {
    c.getPA().startTeleport(2683, 3725, 0, "modern");
    c.sendMessage("You can train here!");
    } else {
    c.sendMessage("You need a combat level of 50 to teleport here.");
    }
    }
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. [pi]Combat change command
    By Zattion in forum Help
    Replies: 8
    Last Post: 03-06-2011, 09:50 AM
  2. Replies: 3
    Last Post: 01-20-2011, 03:02 AM
  3. Replies: 6
    Last Post: 07-14-2010, 04:05 AM
  4. PI lunar hometeleport & command
    By zecerew in forum Help
    Replies: 2
    Last Post: 07-08-2010, 10:32 AM
  5. Wildy Combat Requirements.
    By Swarfega in forum Tutorials
    Replies: 18
    Last Post: 10-03-2008, 02:39 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
  •