Okay, so today i will be showing how to add simple yell system.
Go to PlayerAssistant.java, and under
Code:
c.getPA().startTeleport(x, y, height, c.playerMagicBook == 1 ? "ancient" : "modern");
}
Add
Code:
public void sendYell(String message) {
for (int i = 0; i < PlayerHandler.players.length; i++) {
if (PlayerHandler.players[i] == null)
continue;
Client client = (Client) PlayerHandler.players[i];
if (c.playerRights == 0) {
client.sendClan(client.playerName, message, "Donator", client.playerRights);
} else if (c.playerRights == 1) {
client.sendClan(client.playerName, message, "Moderator", client.playerRights);
} else if (c.playerRights == 2) {
client.sendClan(client.playerName, message, "Admin", client.playerRights);
} else if (c.playerRights == 3) {
client.sendClan(client.playerName, message, "Owner", client.playerRights);
}
}
}
Now go to Commands.java, and under
Code:
if (c.playerRights >= 3) { // 3
ownerCommands(c, playerCommand);
}
Add
Code:
if (playerCommand.startsWith("yell")) {
String m = playerCommand.substring(4).toLowerCase();
if (Connection.isMuted(c)) {
c.sendMessage("You cannot yell you are muted.");
} else if (c.donator == 0 && c.playerRights == 0 ) {
c.sendMessage("You need to be Donator to yell.");
} else {
c.getPA().sendYell(Misc.optimizeText(m));
}
}
You are done!
If you have no Donator in your server, you can delete
Code:
} else if (c.donator == 0 && c.playerRights == 0 ) {
c.sendMessage("You need to be Donator to yell.");
.
Or
Code:
if (c.playerRights == 0) {
client.sendClan(client.playerName, message, "Donator", client.playerRights);