Thread: Hello Need Help

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Hello Need Help 
    Novice Developer
    Solnes's Avatar
    Join Date
    Jul 2017
    Posts
    89
    Thanks given
    12
    Thanks received
    3
    Rep Power
    36
    I am new to coding. Please do not flame or hate.

    Hello everyone i am looking for help with my ;;yell command. When ever someone does the yell command this happens
    Attached image

    this is my code.
    Code:
    if (playerCommand.startsWith("yell")) {
    			for (int j = 0; j < PlayerHandler.players.length; j++) {
    				if (PlayerHandler.players[j] != null) {
    					Client c2 = (Client) PlayerHandler.players[j];
    
    					if (!Connection.isMuted(c2)) {
    					if (c2.npcKills < 0) {
    							c2.sendMessage("You need atleast 1 NPC Kill before you can yell");
    							return;
    						 }
    
    						if (c2.playerName.equalsIgnoreCase("Solnes") && c2.playerRights == 3) {
    							c2.sendMessage("<shad=800000000>[Main-Owner/Developer]" + Misc.optimizeText(c2.playerName) + ":<shad=6352853> " + Misc.optimizeText(playerCommand.substring(4)) + "");
    						//} else if (c1.playerName.equalsIgnoreCase("") && c1.playerRights == 3) {
    							//c1.sendMessage("<shad=800000000>[Main-Owner/Developer]" + Misc.optimizeText(c1.playerName) + ":<shad=6352853> " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 10) {
    							c2.sendMessage("<shad=99999999>[TrustedDicer] " + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 7) {
    							c2.sendMessage("<shad=52984>[Helper] " + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 8) {
    							c2.sendMessage("<shad=16014601>[Youtuber] " + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 9) {
    							c2.sendMessage("<shad=16014601>[Media manager] " + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 6) {
    							c2.sendMessage("<shad=20451204>[Sponsor] " + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 2) {
    							c2.sendMessage("<shad=200000000>[Administrator]</col>" + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 1) {
    							c2.sendMessage("<shad=12406447>[Moderator]</col>" + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 0) {
    							c2.sendMessage("<shad=12543365>[Player]</col>" + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 5 && c2.issDonator == 1) {
    							c2.sendMessage("<shad=15692059>[Super Donator] " + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 4 && c2.isDonator == 1) {
    							c2.sendMessage("<shad=15692059>[Donator] " + Misc.optimizeText(c2.playerName) + "<shad=6352853>: " + Misc.optimizeText(playerCommand.substring(5)) + "");
    						}
    					} else if (c2.isInJail()) {
    						c2.sendMessage("<shad=15692059>Please inform a staff member!");
    						return;
    					}
    
    				}
    			}
    		}
    	}
    If someone can help me out i will greatly appreciate it.

    Thank you for looking into this post.
    Last edited by Solnes; 01-14-2018 at 05:15 AM.
    Thanks for reading
    King Regards,
    Solnes

    Owner & Developer of
    Attached image
    Reply With Quote  
     

  2. #2  
    Extreme Donator


    Join Date
    Nov 2011
    Posts
    311
    Thanks given
    15
    Thanks received
    94
    Rep Power
    361
    Are you wanting to remove the turqouise looking text?
    If so here,

    Code:
    if (playerCommand.startsWith("yell")) {
    			for (int j = 0; j < PlayerHandler.players.length; j++) {
    				if (PlayerHandler.players[j] != null) {
    					Client c2 = (Client) PlayerHandler.players[j];
    
    					if (!Connection.isMuted(c2)) {
    					if (c2.npcKills < 0) {
    							c2.sendMessage("You need atleast 1 NPC Kill before you can yell");
    							return;
    						 }
    
    						if (c2.playerName.equalsIgnoreCase("Solnes") && c2.playerRights == 3) {
    							c2.sendMessage("<shad=800000000>[Main-Owner/Developer]" + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(4)) + "");
    						//} else if (c1.playerName.equalsIgnoreCase("") && c1.playerRights == 3) {
    							//c1.sendMessage("<shad=800000000>[Main-Owner/Developer]" + Misc.optimizeText(c1.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 10) {
    							c2.sendMessage("<shad=99999999>[TrustedDicer] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 7) {
    							c2.sendMessage("<shad=52984>[Helper] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 8) {
    							c2.sendMessage("<shad=16014601>[Youtuber] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 9) {
    							c2.sendMessage("<shad=16014601>[Media manager] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 6) {
    							c2.sendMessage("<shad=20451204>[Sponsor] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 2) {
    							c2.sendMessage("<shad=200000000>[Administrator]</col>" + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 1) {
    							c2.sendMessage("<shad=12406447>[Moderator]</col>" + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 0) {
    							c2.sendMessage("<shad=12543365>[Player]</col>" + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 5 && c2.issDonator == 1) {
    							c2.sendMessage("<shad=15692059>[Super Donator] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 4 && c2.isDonator == 1) {
    							c2.sendMessage("<shad=15692059>[Donator] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						}
    					} else if (c2.isInJail()) {
    						c2.sendMessage("<shad=15692059>Please inform a staff member!");
    						return;
    					}
    
    				}
    			}
    		}
    	}
    Reply With Quote  
     

  3. #3  
    Novice Developer
    Solnes's Avatar
    Join Date
    Jul 2017
    Posts
    89
    Thanks given
    12
    Thanks received
    3
    Rep Power
    36
    Quote Originally Posted by Leviticus View Post
    Are you wanting to remove the turqouise looking text?
    If so here,

    Code:
    if (playerCommand.startsWith("yell")) {
    			for (int j = 0; j < PlayerHandler.players.length; j++) {
    				if (PlayerHandler.players[j] != null) {
    					Client c2 = (Client) PlayerHandler.players[j];
    
    					if (!Connection.isMuted(c2)) {
    					if (c2.npcKills < 0) {
    							c2.sendMessage("You need atleast 1 NPC Kill before you can yell");
    							return;
    						 }
    
    						if (c2.playerName.equalsIgnoreCase("Solnes") && c2.playerRights == 3) {
    							c2.sendMessage("<shad=800000000>[Main-Owner/Developer]" + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(4)) + "");
    						//} else if (c1.playerName.equalsIgnoreCase("") && c1.playerRights == 3) {
    							//c1.sendMessage("<shad=800000000>[Main-Owner/Developer]" + Misc.optimizeText(c1.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 10) {
    							c2.sendMessage("<shad=99999999>[TrustedDicer] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 7) {
    							c2.sendMessage("<shad=52984>[Helper] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 8) {
    							c2.sendMessage("<shad=16014601>[Youtuber] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 9) {
    							c2.sendMessage("<shad=16014601>[Media manager] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 6) {
    							c2.sendMessage("<shad=20451204>[Sponsor] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 2) {
    							c2.sendMessage("<shad=200000000>[Administrator]</col>" + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 1) {
    							c2.sendMessage("<shad=12406447>[Moderator]</col>" + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 0) {
    							c2.sendMessage("<shad=12543365>[Player]</col>" + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 5 && c2.issDonator == 1) {
    							c2.sendMessage("<shad=15692059>[Super Donator] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						} else if (c2.playerRights == 4 && c2.isDonator == 1) {
    							c2.sendMessage("<shad=15692059>[Donator] " + Misc.optimizeText(c2.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    						}
    					} else if (c2.isInJail()) {
    						c2.sendMessage("<shad=15692059>Please inform a staff member!");
    						return;
    					}
    
    				}
    			}
    		}
    	}
    no when ever someone does the yell command. it shows up as someone else's yell as you can see in the picture. i didn't yell with the main owner/dev account just on the regular player account
    Last edited by Solnes; 01-14-2018 at 05:16 AM.
    Thanks for reading
    King Regards,
    Solnes

    Owner & Developer of
    Attached image
    Reply With Quote  
     

  4. #4  
    Extreme Donator


    Join Date
    Nov 2011
    Posts
    311
    Thanks given
    15
    Thanks received
    94
    Rep Power
    361
    Quote Originally Posted by Solnes View Post
    no when ever someone does the yell command. it shows up as someone else's yell as you can see in the picture. i didn't yell with the main owner/dev account just on the regular player account
    Change:
    Misc.optimizeText(c2.playerName)

    To:
    Misc.optimizeText(c.playerName)
    Reply With Quote  
     

  5. #5  
    Novice Developer
    Solnes's Avatar
    Join Date
    Jul 2017
    Posts
    89
    Thanks given
    12
    Thanks received
    3
    Rep Power
    36
    Quote Originally Posted by Leviticus View Post
    Change:
    Misc.optimizeText(c2.playerName)

    To:
    Misc.optimizeText(c.playerName)
    i changed it now this happens
    Attached image

    If anyone knows how to fix send me a pm on here or add me on discord (solnes#4345)

    for my end code does it need to change the .substring (number));
    Code:
    Misc.optimizeText(playerCommand.substring(5)) + "");
    or this

    Code:
    Misc.optimizeText(playerCommand.substring(4)) + "");
    Last edited by Solnes; 01-14-2018 at 05:16 AM.
    Thanks for reading
    King Regards,
    Solnes

    Owner & Developer of
    Attached image
    Reply With Quote  
     

  6. #6  
    xd


    Join Date
    Oct 2007
    Age
    28
    Posts
    6,078
    Thanks given
    98
    Thanks received
    488
    Rep Power
    5000
    iirc it should be 5 because yell is a 4 letter command and you have to account for the space you type afterwards

    also what does the optimizeText method do?
    Quote Originally Posted by clem585 View Post
    Wat. Reading java doc isn't going to teach you anything. It's like reading the dictionary to learn grammatical rules.
    Reply With Quote  
     

  7. #7  
    Novice Developer
    Solnes's Avatar
    Join Date
    Jul 2017
    Posts
    89
    Thanks given
    12
    Thanks received
    3
    Rep Power
    36
    Quote Originally Posted by Austin_ View Post
    iirc it should be 5 because yell is a 4 letter command and you have to account for the space you type afterwards

    also what does the optimizeText method do?
    okay it is at substring is on 5 and now this happens.... i dont understand it, im not sure i didnt make this code.

    Attached image
    Thanks for reading
    King Regards,
    Solnes

    Owner & Developer of
    Attached image
    Reply With Quote  
     

  8. #8  
    xd


    Join Date
    Oct 2007
    Age
    28
    Posts
    6,078
    Thanks given
    98
    Thanks received
    488
    Rep Power
    5000
    you rly need to make a video because there it looks exactly how it should
    Quote Originally Posted by clem585 View Post
    Wat. Reading java doc isn't going to teach you anything. It's like reading the dictionary to learn grammatical rules.
    Reply With Quote  
     

  9. Thankful user:


  10. #9  
    Novice Developer
    Solnes's Avatar
    Join Date
    Jul 2017
    Posts
    89
    Thanks given
    12
    Thanks received
    3
    Rep Power
    36
    Quote Originally Posted by Austin_ View Post
    you rly need to make a video because there it looks exactly how it should
    if you look at the first part of the picture it says

    Owner/Dev Act: Hello act
    Player Act: Hello solnes

    if you look at the 2nd part of the pic it says

    Owner/Dev Solnes:Hello act
    Player Act: Hello solnes

    if shows up normal on my main account but not normal on my random account.

    Quote Originally Posted by Austin_ View Post
    you rly need to make a video because there it looks exactly how it should
    I have made it do this and it still does the same thing at i showed in the last picture
    Code:
    if (c.playerName.equalsIgnoreCase("Solnes") && c.playerRights == 3) {
    							c2.sendMessage("<shad=800000000>[Main-Owner/Developer]" + (c.playerName) + ":<shad=6352853> " + Misc.optimizeText(playerCommand.substring(5)) + "");
    I have figure out the problem and it is fixed! Thank you everyone who has helped me
    Thanks for reading
    King Regards,
    Solnes

    Owner & Developer of
    Attached image
    Reply With Quote  
     

  11. #10  
    Extreme Donator

    mrmanager's Avatar
    Join Date
    Feb 2017
    Posts
    48
    Thanks given
    20
    Thanks received
    42
    Rep Power
    236
    Here. You're mixing up your variable names.

    Code:
    if (playerCommand.startsWith("yell")) {
    	if (c.npcKills < 0) {
    		c.sendMessage("You need at least 1 NPC Kill before you can yell");
    		return;
    	}
    	if (Connection.isMuted(c)) {
    		c.sendMessage("You are muted.");
    		return;
    	} else if (c.isInJail()) {
    		c.sendMessage("You are jailed.");
    		return;
    	}
    	for (int j = 0; j < PlayerHandler.players.length; j++) {
    		if (PlayerHandler.players[j] != null) {
    			Client c2 = (Client) PlayerHandler.players[j];
    			if (c.playerName.equalsIgnoreCase("Solnes") && c.playerRights == 3) {
    				c2.sendMessage("<shad=800000000>[Main-Owner/Developer]" + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(4)) + "");
    			} else if (c.playerRights == 10) {
    				c2.sendMessage("<shad=99999999>[TrustedDicer] " + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			} else if (c.playerRights == 7) {
    				c2.sendMessage("<shad=52984>[Helper] " + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			} else if (c.playerRights == 8) {
    				c2.sendMessage("<shad=16014601>[Youtuber] " + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			} else if (c.playerRights == 9) {
    				c2.sendMessage("<shad=16014601>[Media manager] " + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			} else if (c.playerRights == 6) {
    				c2.sendMessage("<shad=20451204>[Sponsor] " + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			} else if (c.playerRights == 2) {
    				c2.sendMessage("<shad=200000000>[Administrator]</col>" + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			} else if (c.playerRights == 1) {
    				c2.sendMessage("<shad=12406447>[Moderator]</col>" + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			} else if (c.playerRights == 0) {
    				c2.sendMessage("<shad=12543365>[Player]</col>" + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			} else if (c.playerRights == 5 && c2.issDonator == 1) {
    				c2.sendMessage("<shad=15692059>[Super Donator] " + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			} else if (c.playerRights == 4 && c2.isDonator == 1) {
    				c2.sendMessage("<shad=15692059>[Donator] " + Misc.optimizeText(c.playerName) + Misc.optimizeText(playerCommand.substring(5)) + "");
    			}
    		}
    	}
    }
    You should use a different source by the way, this ones terrible.
    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. Hello, need help
    By _James in forum Help
    Replies: 11
    Last Post: 10-29-2015, 05:20 PM
  2. Replies: 7
    Last Post: 05-16-2014, 02:15 AM
  3. Hello need help
    By dwolder in forum Help
    Replies: 6
    Last Post: 02-26-2014, 09:46 PM
  4. Replies: 0
    Last Post: 08-02-2011, 03:42 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
  •