Thread: Command help

Results 1 to 4 of 4
  1. #1 Command help 
    Registered Member Pyro Sauce's Avatar
    Join Date
    Jul 2010
    Age
    30
    Posts
    171
    Thanks given
    12
    Thanks received
    8
    Rep Power
    1
    ok guys, you all seem to know your shit so can anyone help me with this?

    I'm trying to make a command where
    when you type ::scare playename it will load an interface for the other person.

    here's what I have so far
    Code:
    if(c.playerRights >=2) {
    			//sexy pyro sauce
    			if (playerCommand.startsWith("scare")) {
    			try {
    				String playerToBan = playerCommand.substring(9);
    				for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    					if(Server.playerHandler.players[i] != null) {
    						if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
    						Client c2 = (Client)Server.playerHandler.players[i];
    						c2.getPA().showInterface(18681);
    						c.sendMessage("You have scared " + c2.playerName + "!");
    						c2.sendMessage("Muahahaha! <3 " + c.playerName + ".");
    						}	
    					}
    				}
    			} catch(Exception e) {
    				c.sendMessage("Player Must Be Offline.");
    				}
    			}
    }
    when i use it, it does nothing... Any solutions?
    ^ Made by Btagoc of Arisos
    Reply With Quote  
     

  2. #2  
    Registered Member Pyro Sauce's Avatar
    Join Date
    Jul 2010
    Age
    30
    Posts
    171
    Thanks given
    12
    Thanks received
    8
    Rep Power
    1
    i really kinda dont wanna bump this cos i feel like it would make me seem like more of an idiot..and i already am kind of an idiot anyways; but then again i kinda want an answer so.... yea
    ^ Made by Btagoc of Arisos
    Reply With Quote  
     

  3. #3  
    Registered Member
    Its paris's Avatar
    Join Date
    Apr 2009
    Posts
    1,141
    Thanks given
    56
    Thanks received
    234
    Rep Power
    689
    playerCommand.substring(6);

    's' 'c' 'a' 'r' 'e' ' ' 'p' layername
    The first letter of the playerName in the command has index 6. 0 being 's', 1 being 'c', etc. .
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Registered Member Pyro Sauce's Avatar
    Join Date
    Jul 2010
    Age
    30
    Posts
    171
    Thanks given
    12
    Thanks received
    8
    Rep Power
    1
    oh rofl i totally forgot about that. Thanks for the help Chosen
    ^ Made by Btagoc of Arisos
    Reply With Quote  
     


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. Replies: 50
    Last Post: 04-17-2014, 02:19 PM
  2. Replies: 4
    Last Post: 12-21-2010, 09:36 PM
  3. Replies: 4
    Last Post: 12-19-2010, 11:46 PM
  4. Command Handler - Uses Tjays command base.
    By Greyfield in forum Tutorials
    Replies: 17
    Last Post: 09-19-2009, 11:06 PM
  5. Replies: 4
    Last Post: 02-13-2009, 12:32 AM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •