Works fine on mine >.> maybe because you might have to implement something else in a different file for it to have a title ? I have 2 spaces in my username and it works. Try re writing the command different format
|
Most of my commands do not register if the player had two words in their username, any ideas?
For instance:
Code:if (playerCommand.startsWith("givetitle") && c.playerName.equalsIgnoreCase("Ain")) { if (c.playerRights != 3) return; try { String[] args = playerCommand.split(" "); if (args.length == 3) { int titleId = Integer.parseInt(args[1]); String playerToGiveTitle = args[2]; for(int i = 0; i < PlayerHandler.players.length; i++) { if(PlayerHandler.players[i] != null) { if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToGiveTitle)) { Client o = (Client)PlayerHandler.players[i]; c.sendMessage("You have given "+ Misc.optimizeText(o.playerName) +" a title."); o.sendMessage("You have been give a title by "+ Misc.optimizeText(c.playerName) +"."); o.playerTitle = titleId; o.getPA().requestUpdates(); return; } } } } else { c.sendMessage("Wrong usage of this command!"); } } catch (Exception e) { c.sendMessage("Player must be offline."); } }
Works fine on mine >.> maybe because you might have to implement something else in a different file for it to have a title ? I have 2 spaces in my username and it works. Try re writing the command different format
BUMP I also need it for 3 letter names >.>
When typing the username, use underscores '_' instead of spaces ' '.
Then when processing the username, which should be args[2] (with underscores), replace the underscores with spaces:
Code:String playerToGiveTitle = args[2].replace('_', ' ');
Try changing this:
Change the "3" too the max amount of characters you can put in a name. But put an extra number after..Code:if (args.length == 3) {
For example:
Too:Code:if (args.length == 3) {
if you choose 8 put 9.Code:if (args.length == 9) {
Total guess so try it.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |