Thread: help with ::alert command

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 help with ::alert command 
    Registered Member
    Join Date
    Aug 2010
    Posts
    19
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    i was trying to edit my ::alert command.

    right now it is
    Code:
    else if (command.startsWith("alert") && playerRights >= 4)
    			{
    			try {
    
    			String announcement = command.substring(8);
    			PlayerHandler.messageToAll = "[OWNER]" + playerName + command.substring(8);
    			sendMessage("You have successfully sent an announcement.");
    
    			} catch(Exception e) {
    			sendMessage("Wrong syntax! Use ::announce [ANNOUNCEMENT].");
    			}
    }
    I want to make the [OWNER] look like this [OWNER] in the server. any help?
    Reply With Quote  
     

  2. #2  
    Registered Member Akeid's Avatar
    Join Date
    May 2009
    Posts
    911
    Thanks given
    22
    Thanks received
    15
    Rep Power
    37
    @pur@
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Aug 2010
    Posts
    25
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    You just got to add the colour code so example, [p]Owner[/p] hope this works it worked in my server
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    2,661
    Thanks given
    66
    Thanks received
    207
    Rep Power
    0
    Try this?

    Code:
    String cmd[] = command.split(" ");
    cmd[0] = cmd[0].toLowerCase();
    
    if (cmd[0].equals("alert") && playerRights > 3) {
    	if (cmd.length > 1) {
    		PlayerHandler.messageToAll = "@pur@[OWNER]@bla@" + playerName + command.substring(cmd[0].length() + 1);
    	} else {
    		sendMessage("Try ::alert hello everyone this is the alert command.");
    	}
    }
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Oct 2009
    Age
    28
    Posts
    1,579
    Thanks given
    4
    Thanks received
    23
    Rep Power
    0
    ^That should work
    Reply With Quote  
     

  6. #6  
    Registered Member
    FuckThePolice's Avatar
    Join Date
    Feb 2009
    Age
    30
    Posts
    846
    Thanks given
    29
    Thanks received
    57
    Rep Power
    87
    Wouldn't he have to add the @pur@ color via client-side?
    Reply With Quote  
     

  7. #7  
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    2,661
    Thanks given
    66
    Thanks received
    207
    Rep Power
    0
    Then lookup unborn's color in clients guide.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Aug 2010
    Posts
    19
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Quote Originally Posted by digistr View Post
    Try this?

    Code:
    String cmd[] = command.split(" ");
    cmd[0] = cmd[0].toLowerCase();
    
    if (cmd[0].equals("alert") && playerRights > 3) {
    	if (cmd.length > 1) {
    		PlayerHandler.messageToAll = "@pur@[OWNER]@bla@" + playerName + command.substring(cmd[0].length() + 1);
    	} else {
    		sendMessage("Try ::alert hello everyone this is the alert command.");
    	}
    }
    eh gave me 100 errors. guess that doesnt work
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Aug 2010
    Posts
    19
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Quote Originally Posted by Murk View Post
    You just got to add the colour code so example, [p]Owner[/p] hope this works it worked in my server
    na that didnt work it shows up as [p][OWNER][/p] when i use alert
    Reply With Quote  
     

  10. #10  
    Registered Member Zylsium's Avatar
    Join Date
    Jun 2010
    Posts
    111
    Thanks given
    2
    Thanks received
    2
    Rep Power
    3
    Hmm,

    Code:
    else if (command.startsWith("alert") && playerRights >= 4)
    			{
    			try {
    
    			String announcement = command.substring(8);
    			PlayerHandler.messageToAll = "@blu@[OWNER]" + playerName + command.substring(8);
    			sendMessage("You have successfully sent an announcement.");
    
    			} catch(Exception e) {
    			sendMessage("Wrong syntax! Use ::announce [ANNOUNCEMENT].");
    			}
    }
    Try that, not 100% sure it works.
    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

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