maybe post the errors?
|
I add this command and when i compile it gives me error please help tell me whats wrong with this command...
if (playerCommand.startsWith("givemod")) {
try {
String playerToMod = playerCommand.substring(8);
for(int i = 0; i < Config.MAX_PLAYERS; i++) {
if(PlayerHandler.players[i] != null) {
if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
Client c2 = (Client)PlayerHandler.players[i];
c2.sendMessage("You have been given mod status by " + c.playerName);
c2.playerRights = 1;
c2.isDonator = false;
c2.logout();
break;
}
}
}
} catch(Exception e) {
c.sendMessage("Player must be offline, or they don't exist.");
}
}
Post the errors...
I found that on my old source, should work.Code:if (playerCommand.startsWith("givemod")) { try { String playerToMod = playerCommand.substring(8); for(int i = 0; i < Config.MAX_PLAYERS; i++) { if(Server.playerHandler.players[i] != null) { if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) { Client c2 = (Client)Server.playerHandler.players[i]; c2.sendMessage("You have been given mod status by " + c.playerName); c2.playerRights = 1; c2.logout(); break; } } } } catch(Exception e) { c.sendMessage("Player Must Be Offline."); } }
Edit: That's the same thing, lol. Just neater - nvm. We can only help if you tell us the error.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |