Thread: Yell Name Capitalisation + Message glitch

Results 1 to 4 of 4
  1. #1 Yell Name Capitalisation + Message glitch 
    Registered Member
    Join Date
    Dec 2010
    Posts
    38
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    Fixed the capitalisation, now my only problem is every 2 chars of the yell get blanked/deleted?



    Code:
    		if(playerCommand.startsWith("yell")) {
    				if(!Connection.isMuted(c)) {
    					for(int j = 0; j < Server.playerHandler.players.length; j++) {
    						if(Server.playerHandler.players[j] != null) {
    							Client c2 = (Client)Server.playerHandler.players[j];
    							if(c.playerRights == 2) {
    								c2.sendMessage("@bla@[@cya@ASSISTANT@bla@]@blu@"+Misc.optimizeText(c.playerName)+":"+playerCommand.substring(7));
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Oct 2011
    Age
    28
    Posts
    1,880
    Thanks given
    311
    Thanks received
    557
    Rep Power
    703
    Looks like it might be this:
    playerCommand.substring(7)
    try changing the 7 to something lower.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Dec 2010
    Posts
    38
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    Fixed it thanks bro
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    2,661
    Thanks given
    66
    Thanks received
    207
    Rep Power
    0
    Shouldn't usernames be capitalized / formatted upon login?


    Try something like this:

    Code:
    String[] cmd = playerCommand.split(" ");
    cmd[0] = cmd[0].toLowerCase();
    String message = playerCommand.substring(cmd[0].length + 1);
    
    if(cmd[0].equals("yell") && c.playerRights == 2) 
    {
    	if(!Connection.isMuted(c)) 
    	{
    		for(Player player : Server.playerHandler.players) 
    		{
    			if(player != null) 
    			{
    				((Client)player).sendMessage("@bla@[@cya@ASSISTANT@bla@]@blu@" + Misc.optimizeText(c.playerName) + ":" + message);
    			}
    		}
    	}
    }
    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. message to server like a yell?
    By shlomi84 in forum Help
    Replies: 10
    Last Post: 04-28-2012, 05:54 AM
  2. Yell message (PI)
    By James-RevolutionX in forum Help
    Replies: 0
    Last Post: 03-04-2012, 10:27 PM
  3. [PI] Capital names/message in yell
    By Asphyxiation in forum Help
    Replies: 3
    Last Post: 01-28-2012, 07:50 PM
  4. [PI] Yell Message
    By EndLessPK' in forum Help
    Replies: 2
    Last Post: 07-14-2011, 08:18 PM
  5. auto, random server message/yell? rep
    By b00mz in forum Help
    Replies: 4
    Last Post: 12-09-2010, 11:46 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
  •