remove the && c.playerrights >= 1 and place it under this void
public void moderatorCommands(Client c, String playerCommand)
|
if (playerCommand.startsWith("mute") && c.playerRights >= 1) {
try {
String playerToBan = playerCommand.substring(5);
Connection.addNameToMuteList(playerToBan);
for (int i = 0; i < Config.MAX_PLAYERS; i++) {
if (Server.playerHandler.players[i] != null) {
if (Server.playerHandler.players[i].playerName
.equalsIgnoreCase(playerToBan)) {
Client c2 = (Client) Server.playerHandler.players[i];
c2.sendMessage("You have been muted by: "
+ c.playerName);
c2.sendMessage(" " + c2.playerName
+ " Got Muted By " + c.playerName + ".");
break;
}
}
}
} catch (Exception e) {
c.sendMessage("Player Must Be Offline.");
}
}
my mute command the thign is donators can use it since they are rights 4 how do i fix?
remove the && c.playerrights >= 1 and place it under this void
public void moderatorCommands(Client c, String playerCommand)
i dont have that void....
Code:if (playerCommand.startsWith("mute") && c.playerRights == 1) { try { String playerToBan = playerCommand.substring(5); Connection.addNameToMuteList(playerToBan); for (int i = 0; i < Config.MAX_PLAYERS; i++) { if (Server.playerHandler.players[i] != null) { if (Server.playerHandler.players[i].playerName .equalsIgnoreCase(playerToBan)) { Client c2 = (Client) Server.playerHandler.players[i]; c2.sendMessage("You have been muted by: " + c.playerName); c2.sendMessage(" " + c2.playerName + " Got Muted By " + c.playerName + "."); break; } } } } catch (Exception e) { c.sendMessage("Player Must Be Offline."); } }
here you go then
assuming 1 = moderator 2 = admin 3 = owner 4 = donatorCode:if (playerCommand.startsWith("mute") && c.playerRights == 1 && c.playerRights == 2 && c.playerRights == 3) { try { String playerToBan = playerCommand.substring(5); Connection.addNameToMuteList(playerToBan); for (int i = 0; i < Config.MAX_PLAYERS; i++) { if (Server.playerHandler.players[i] != null) { if (Server.playerHandler.players[i].playerName .equalsIgnoreCase(playerToBan)) { Client c2 = (Client) Server.playerHandler.players[i]; c2.sendMessage("You have been muted by: " + c.playerName); c2.sendMessage(" " + c2.playerName + " Got Muted By " + c.playerName + "."); break; } } } } catch (Exception e) { c.sendMessage("Player Must Be Offline."); } }
in the future remember when a command in this format
Code:(playerCommand.startsWith("mute") && c.playerRights >= 1)means anybody with power 1 or greater can use this commandCode:c.playerRights >= 1
and if you dont have the moderator voids and you want to change that you need to change it to something like this
which fixes it so that only a moderator can now use that command and nobody else.Code:c.playerRights == 1
Now mods, admins, and owners, can use it, but not donorsCode:if (playerCommand.equals("mute") && c.playerRights >= 1 && c.playerRights <= 3){ //code }
[QUOTE=Unearth;3540257]here you go then
Lmao, that would mean they would need player right 1,2, and 3, derp :/Code:if (playerCommand.startsWith("mute") && c.playerRights == 1 && c.playerRights == 2 && c.playerRights == 3) { try { String playerToBan = playerCommand.substring(5); Connection.addNameToMuteList(playerToBan); for (int i = 0; i < Config.MAX_PLAYERS; i++) { if (Server.playerHandler.players[i] != null) { if (Server.playerHandler.players[i].playerName .equalsIgnoreCase(playerToBan)) { Client c2 = (Client) Server.playerHandler.players[i]; c2.sendMessage("You have been muted by: " + c.playerName); c2.sendMessage(" " + c2.playerName + " Got Muted By " + c.playerName + "."); break; } } } } catch (Exception e) { c.sendMessage("Player Must Be Offline."); } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |