Purpose: Adding donator rank , with working crows!
req: My client-sided tut: [Only registered and activated users can see links. ]
Difficulty:2,5/10 (5/10 if you are begginer)
Assumed Knowledge: Copy And Past
Classes Modified: client.java and player.java (server-sided)
Tested On(if it applies): Delta but should work on all. and fubergen client.
Step 1 - open your client.java and find something like:
Code:
} else if (token.equals("character-assault")) {
assaultKills = Integer.parseInt(token2);
under it add:
Code:
} else if (token.equals("character-donator")) {
donator = Integer.parseInt(token2);
then find something like
Code:
characterfile.write("character-assault = ", 0, 20);
characterfile.write(Integer.toString(assaultKills), 0, Integer.toString(assaultKills).length());
characterfile.newLine();
and under that code add:
Code:
characterfile.write("character-donator = ", 0, 20);
characterfile.write(Integer.toString(donator), 0, Integer.toString(donator).length());
characterfile.newLine();
now find for something like:
Code:
// mod/admin level crown fix -bakatool
if (playerRights == 3)
out.write(2);
else if (playerRights == 2)
out.write(2);
else if (playerRights == 1)
out.write(1);
and in there add:
Code:
else if(donator == 1 && playerRights == 0)
out.write(7);
now if you want give donator command so add this to your other commands:
Code:
if (command.startsWith("gived") && playerName.equalsIgnoreCase("xxxx")) {
String name = command.substring(6);
try {
int p = PlayerHandler.getPlayerID(name);
client c = (client) server.playerHandler.players[p];
c.donator = 1;
savegame(true);
c.disconnected = true;
sM("You just gave"+command.substring(4)+" donator");
} catch(Exception e) {
sM(name+" either isn't online or doesn't exist");
}
}
and change the xxxx to your username
now close client.java and open player.java
and add this with your other ints:
Code:
public int donator;
and then find:
Code:
protected void appendPlayerChatText(stream str) {
and replace it with mine:
Code:
protected void appendPlayerChatText(stream str) {
str.writeWordBigEndian(((chatTextColor & 0xFF) << 8)
+ (chatTextEffects & 0xFF));
if(donator == 1 && playerRights == 0)str.writeByte(7);
else if(playerRights == 3) str.writeByte(2);
else
str.writeByte(playerRights);
str.writeByteC(chatTextSize);
// no more than 256 bytes!!!
str.writeBytes_reverse(chatText, chatTextSize, 0);
}
just save + compile and test!
Done!!!
creadits:
80% for me to codes
and
20% for the server base