Thread: Adding name restrictions to teleport commands. [PI]

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 Adding name restrictions to teleport commands. [PI] 
    Registered Member
    Join Date
    Feb 2014
    Posts
    12
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Okay so right now this is my command:


    if (playerCommand.startsWith("teleto") && c.playerRights >= 2) {
    if (c.inWild())
    return;
    String name = playerCommand.substring(5);
    for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    if (Server.playerHandler.players[i] != null) {
    if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
    c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
    }
    }
    }
    }

    I want to add a restriction to it so players cant teleport to certain names. Like so they can type "::teleto owner peter" and go to him.
    Reply With Quote  
     

  2. #2  
    Retired From RSPS

    iGarrett's Avatar
    Join Date
    Dec 2013
    Posts
    461
    Thanks given
    144
    Thanks received
    110
    Rep Power
    187
    ...I don't see your point.. The command will take you to whatever player you put in...
    Quote Originally Posted by i am here View Post
    I have never messed with Eclipse. Is it a whole new revision or type of code?
    Quote Originally Posted by bibl View Post
    hahaha, good one m9. "deob" is short for "deobfuscated" which is not the same as decompiled.
    I'm GEEGIN' OUT
    Reply With Quote  
     

  3. #3  
    Irathient Developer

    mr selby's Avatar
    Join Date
    May 2011
    Age
    28
    Posts
    1,183
    Thanks given
    95
    Thanks received
    166
    Rep Power
    97
    Quote Originally Posted by Olean_Pkz View Post
    Okay so right now this is my command:





    I want to add a restriction to it so players can teleport to certain names. Like so they can type "::teleto owner peter" and go to him.
    Reply With Quote  
     

  4. #4  
    Member of the Imagine Cult

    Join Date
    Feb 2013
    Posts
    519
    Thanks given
    21
    Thanks received
    7
    Rep Power
    59
    Code:
    if (playerCommand.startsWith("teleto") && c.playerRights >= 2) {
    if (c.inWild())
    return;
    String name = playerCommand.substring(5);
    if (name = "Owner Peter") {
    for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    if (Server.playerHandler.players[i] != null) {
    if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
    c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
    } else {
    c.sendMessage("You can only teleport to Owner Peter");
    }
    }
    }
    }	
    }
    I believe that should work or something like it, though there is a much better way to do it.
    Reply With Quote  
     

  5. #5  
    Java Developer

    Anezka's Avatar
    Join Date
    Aug 2013
    Age
    30
    Posts
    373
    Thanks given
    96
    Thanks received
    95
    Rep Power
    174
    Code:
    if (playerCommand.startsWith("teleto") && c.playerRights >= 2) {
    	String[] restricted = { "name", "bob" };
    	if (c.inWild()) {
    		return;
    	}
    	String name = playerCommand.substring(5);
    	for(int j = 0; j < restricted.lenght; i++) {
    		if(name.equalsIgnoreCase(restricted[j])) {
    			return;
    		}
    	}
    	for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    		if (Server.playerHandler.players[i] != null) {
    			if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
    				c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
    			}
    		}
    	}	
    }
    Reply With Quote  
     

  6. #6  
    Member of the Imagine Cult

    Join Date
    Feb 2013
    Posts
    519
    Thanks given
    21
    Thanks received
    7
    Rep Power
    59
    Not sure if you wanted your players to be only able to teleport to the owner or add him as an restriction so they can't.. Please clarify that :/
    Reply With Quote  
     

  7. #7  
    Java Developer

    Anezka's Avatar
    Join Date
    Aug 2013
    Age
    30
    Posts
    373
    Thanks given
    96
    Thanks received
    95
    Rep Power
    174
    Quote Originally Posted by FiveRiverFlo View Post
    Not sure if you wanted your players to be only able to teleport to the owner or add him as an restriction so they can't.. Please clarify that :/
    Hell if I know I'm Czech and my English better then his lol.
    Reply With Quote  
     

  8. #8  
    Member of the Imagine Cult

    Join Date
    Feb 2013
    Posts
    519
    Thanks given
    21
    Thanks received
    7
    Rep Power
    59
    Quote Originally Posted by Asuna Yuuki View Post
    Hell if I know I'm Czech and my English better then his lol.
    lol not Nice, but I think he meant so players can only teleport to the owner, because the command is originally built for staff and he wants players to be able to do it..
    Reply With Quote  
     

  9. #9  
    Java Developer

    Anezka's Avatar
    Join Date
    Aug 2013
    Age
    30
    Posts
    373
    Thanks given
    96
    Thanks received
    95
    Rep Power
    174
    Quote Originally Posted by FiveRiverFlo View Post
    lol not Nice, but I think he meant so players can only teleport to the owner, because the command is originally built for staff and he wants players to be able to do it..
    I get what your saying he said restrictions which has no pliable use for what hes asking for. So in reality he just needs to remove the rights from the if statement.
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Feb 2014
    Posts
    12
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Im trying to make it so they CANT teleport to the owner.
    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] adding a more to teleports + tele's
    By syndrome-scape in forum Snippets
    Replies: 8
    Last Post: 02-23-2013, 08:19 PM
  2. [PI] Adding a gfx to ::staffzone command
    By RapeScape in forum Help
    Replies: 13
    Last Post: 04-19-2012, 08:50 PM
  3. [PI] How to make Commands? [PI]
    By Amirtje12 in forum Help
    Replies: 4
    Last Post: 08-20-2010, 12:46 PM
  4. [PI] Adding a object to teleport you [PI Based]
    By Juggalo Family in forum Help
    Replies: 0
    Last Post: 08-16-2010, 05:22 PM
  5. [503]Adding A Message to a command[503]
    By Inspired Dreams in forum Tutorials
    Replies: 11
    Last Post: 08-10-2008, 04:30 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
  •