gether
November 27th, 2010, 02:25
Difficulty:5/10(it took me about an hour creating this by myself. since this is mostly c&p should be easy.)
Purpose: This will be a command for mods+ so they can use this and be unattackable by players. They cant use it in wildy or if there under attack.
Base Tested On: Evolution pkz.
Tools/Knowledge Needed: Copy, Paste, Ctrl+f, patience, and a brain.
Files modified:Commands.java Filemanager.java Player.java Playercombat.java Playermagic.java(if you have it. i don't)
There is probably a much easier way to make this but oh well..
I Do Not Give ANYONE Permission To Post This Anywhere Else.
I Would Recommend Making Backups In case This Doesn't Work For You.
Commands.java
if(cmd[0].equals("watchwildy") && p.rights > 0) {
if (p.attackedBy != null) {
p.getActionSender().sendMessage(p, "You cannot use this command while in combat.");
p.requestGFX(1844, 0);
return;
}
if (p.wildernessZone(p.absX, p.absY)) {
p.getActionSender().sendMessage(p, "You cannot use this command in the wilderness.");
return;
}
p.uber = 1;
}
if(cmd[0].equals("watchwildyoff") && p.rights > 0) {
p.uber = 0;
}
Please note that if u save and compile u will get an error so you might want to do that last.
DO NOT HAVE TO DO THE FILEMANAGER.JAVA PARTS! I ONLY DID THEM SO IT OUTWRITTED IN THE PLAYERS FILE SO IF THEY LOGOUT THEY KEEP IT ON/OFF!
Filemanager.java
Go into your char files and find the last line and copy that name. Then go into your FileManager.java and search it..for me it was "null"(idk why but it just was..)
WHAT YOU ARE LOOKING FOR SHOULD BE LOOKING LIKE THIS:
stream.writeString("(the name of it):" + p.
you should see something like this:
stream.writeString("mute:"+p.muteType);
stream.writeString("specAmount:" + p.specAmount);
stream.writeString("spellbook:" + p.spellbook);
stream.writeString("Xlog:" + p.combatType);
stream.writeString("quests:" + p.questStage);
stream.writeString("null");
FileOutputStream out = new FileOutputStream("./data/characters/mainsave/" + p.username + ".dat");
out.write(stream.outBuffer, 0, stream.outOffset);
out.flush();
out.close();
out = null;
}
Now underneath null(or whatever ur last one was. add this:
stream.writeString("Uber:" + p.uber);
should look like this:
stream.writeString("mute:"+p.muteType);
stream.writeString("specAmount:" + p.specAmount);
stream.writeString("spellbook:" + p.spellbook);
stream.writeString("Xlog:" + p.combatType);
stream.writeString("quests:" + p.questStage);
stream.writeString("null");
stream.writeString("Uber:" + p.uber);
FileOutputStream out = new FileOutputStream("./data/characters/mainsave/" + p.username + ".dat");
out.write(stream.outBuffer, 0, stream.outOffset);
out.flush();
out.close();
out = null;
}
Now do that as many times as the that comes up
Now in the same file look for this
else if(line.startsWith("(what your last one was)")
you should see something like this:
else if (line.startsWith("tabs"))
p.tabStartSlot[Integer.parseInt(line.substring(3, line.indexOf(":")))] = Integer.parseInt(line.substring(line.indexOf(":") + 1));
else if(line.startsWith("quests:"))
p.questStage = Integer.parseInt(line.substring(7));
It should have something like "} else if" instead of just "else if" if its the last one..mine does atleast..remove the } then add this underneath the last one:
} else if (line.startsWith("Uber:")) {
p.uber = Integer.parseInt(line.substring(5));
It should look like this:
else if (line.startsWith("tab"))
p.tabStartSlot[Integer.parseInt(line.substring(3, line.indexOf(":")))] = Integer.parseInt(line.substring(line.indexOf(":") + 1));
else if(line.startsWith("quests:"))
p.questStage = Integer.parseInt(line.substring(7));;
} else if (line.startsWith("Uber:")) {
p.uber = Integer.parseInt(line.substring(5));
}
After that save your filemanager.java
Player.java
Go into your player.java and add this under any other int...
public int uber = 0;
Playercombat.java
Now in playercombat.java search for this:
public void attackPlayer() {
Now somewhere in there add this
if (p.uber == 1) {
p.getActionSender().sendMessage(p, "You cant attack while you moderate.");
p.resetAttack();
return;
}
if (opp.uber == 1) {
p.getActionSender().sendMessage(p, "You cant attack staff while they moderate.");
p.resetAttack();
return;
}
Now save+compile and it should work.
If you have a Playermagic.java just add the above step in there but make it fit..if i had one id show u how :)
100% Credits to Me
Purpose: This will be a command for mods+ so they can use this and be unattackable by players. They cant use it in wildy or if there under attack.
Base Tested On: Evolution pkz.
Tools/Knowledge Needed: Copy, Paste, Ctrl+f, patience, and a brain.
Files modified:Commands.java Filemanager.java Player.java Playercombat.java Playermagic.java(if you have it. i don't)
There is probably a much easier way to make this but oh well..
I Do Not Give ANYONE Permission To Post This Anywhere Else.
I Would Recommend Making Backups In case This Doesn't Work For You.
Commands.java
if(cmd[0].equals("watchwildy") && p.rights > 0) {
if (p.attackedBy != null) {
p.getActionSender().sendMessage(p, "You cannot use this command while in combat.");
p.requestGFX(1844, 0);
return;
}
if (p.wildernessZone(p.absX, p.absY)) {
p.getActionSender().sendMessage(p, "You cannot use this command in the wilderness.");
return;
}
p.uber = 1;
}
if(cmd[0].equals("watchwildyoff") && p.rights > 0) {
p.uber = 0;
}
Please note that if u save and compile u will get an error so you might want to do that last.
DO NOT HAVE TO DO THE FILEMANAGER.JAVA PARTS! I ONLY DID THEM SO IT OUTWRITTED IN THE PLAYERS FILE SO IF THEY LOGOUT THEY KEEP IT ON/OFF!
Filemanager.java
Go into your char files and find the last line and copy that name. Then go into your FileManager.java and search it..for me it was "null"(idk why but it just was..)
WHAT YOU ARE LOOKING FOR SHOULD BE LOOKING LIKE THIS:
stream.writeString("(the name of it):" + p.
you should see something like this:
stream.writeString("mute:"+p.muteType);
stream.writeString("specAmount:" + p.specAmount);
stream.writeString("spellbook:" + p.spellbook);
stream.writeString("Xlog:" + p.combatType);
stream.writeString("quests:" + p.questStage);
stream.writeString("null");
FileOutputStream out = new FileOutputStream("./data/characters/mainsave/" + p.username + ".dat");
out.write(stream.outBuffer, 0, stream.outOffset);
out.flush();
out.close();
out = null;
}
Now underneath null(or whatever ur last one was. add this:
stream.writeString("Uber:" + p.uber);
should look like this:
stream.writeString("mute:"+p.muteType);
stream.writeString("specAmount:" + p.specAmount);
stream.writeString("spellbook:" + p.spellbook);
stream.writeString("Xlog:" + p.combatType);
stream.writeString("quests:" + p.questStage);
stream.writeString("null");
stream.writeString("Uber:" + p.uber);
FileOutputStream out = new FileOutputStream("./data/characters/mainsave/" + p.username + ".dat");
out.write(stream.outBuffer, 0, stream.outOffset);
out.flush();
out.close();
out = null;
}
Now do that as many times as the that comes up
Now in the same file look for this
else if(line.startsWith("(what your last one was)")
you should see something like this:
else if (line.startsWith("tabs"))
p.tabStartSlot[Integer.parseInt(line.substring(3, line.indexOf(":")))] = Integer.parseInt(line.substring(line.indexOf(":") + 1));
else if(line.startsWith("quests:"))
p.questStage = Integer.parseInt(line.substring(7));
It should have something like "} else if" instead of just "else if" if its the last one..mine does atleast..remove the } then add this underneath the last one:
} else if (line.startsWith("Uber:")) {
p.uber = Integer.parseInt(line.substring(5));
It should look like this:
else if (line.startsWith("tab"))
p.tabStartSlot[Integer.parseInt(line.substring(3, line.indexOf(":")))] = Integer.parseInt(line.substring(line.indexOf(":") + 1));
else if(line.startsWith("quests:"))
p.questStage = Integer.parseInt(line.substring(7));;
} else if (line.startsWith("Uber:")) {
p.uber = Integer.parseInt(line.substring(5));
}
After that save your filemanager.java
Player.java
Go into your player.java and add this under any other int...
public int uber = 0;
Playercombat.java
Now in playercombat.java search for this:
public void attackPlayer() {
Now somewhere in there add this
if (p.uber == 1) {
p.getActionSender().sendMessage(p, "You cant attack while you moderate.");
p.resetAttack();
return;
}
if (opp.uber == 1) {
p.getActionSender().sendMessage(p, "You cant attack staff while they moderate.");
p.resetAttack();
return;
}
Now save+compile and it should work.
If you have a Playermagic.java just add the above step in there but make it fit..if i had one id show u how :)
100% Credits to Me