To start off please don't flame I know this is basic this is just to help some kids out .
In this tutorial I will show you how to make a Master and Pure command and how to make it only be able to be used once. I will also explain a little bit in this tutorial.
A Master command will give you 99 attack strength defence range mage and prayer.
A Pure command will give you 99 attack strength range mage.
First go to
src/server/model/players/packets and open Commands.java
And add this for your Master command
Code:
if (playerCommand.startsWith("master") && c.master == 0) {
int i = 0;
c.getPA().addSkillXP((15000000), 0);
c.getPA().addSkillXP((15000000), 1);
c.getPA().addSkillXP((15000000), 2);
c.getPA().addSkillXP((15000000), 3);
c.getPA().addSkillXP((15000000), 4);
c.getPA().addSkillXP((15000000), 5);
c.getPA().addSkillXP((15000000), 6);
c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
c.getPA().refreshSkill(3);
c.master = 1;
}
Pure Command
Code:
if (playerCommand.startsWith("pure") && c.pure == 0) {
int i = 0;
c.getPA().addSkillXP((15000000), 0);
c.getPA().addSkillXP((15000000), 2);
c.getPA().addSkillXP((15000000), 3);
c.getPA().addSkillXP((15000000), 4);
c.getPA().addSkillXP((15000000), 6);
c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
c.getPA().refreshSkill(3);
c.pure = 1;
}
Explanation of command code.
c.getPA().addSkillXP((15000000), 0);
This is the amount of xp the skill will be given
This is the skill id in this case attack
The rest are as follows (Click Spoiler)
To make a command Donator only (This will not work with all servers)
add
Code:
&& c.isDonator == 1
So it would look something like...
Code:
if (playerCommand.startsWith("master") && c.isDonator == 1 && c.master == 0) {
int i = 0;
c.getPA().addSkillXP((15000000), 0);
c.getPA().addSkillXP((15000000), 1);
c.getPA().addSkillXP((15000000), 2);
c.getPA().addSkillXP((15000000), 3);
c.getPA().addSkillXP((15000000), 4);
c.getPA().addSkillXP((15000000), 5);
c.getPA().addSkillXP((15000000), 6);
c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
c.getPA().refreshSkill(3);
c.master = 1;
}
You should also make a message to tell non donar status players that they must be a donator to use the command.
eg.
Code:
if (playerCommand.startsWith("master") && c.isDonator == 0) {
c.sendMessage("Only donators can use ::master");
}
So now when a non donar uses the command a message will appear in their chat box saying "Only donators can use ::master"
Now for a Save token so players can only use it once and not cheat their xp and heal in combat.
Q:What does a save token do?
A:A save token will write in a players file if the player has used the command example as you see their height you will also see if they have used the command this is shown slightly later.
go to:
src/server/model/players and open Player.java
Search for
Under that add...
Now we are going to add some save tokens to tell us if they have used the command.
Now go to:
src/server/model/player and open PlayerSave.java
search for
Code:
} else if (token.equals("character-rights")) {
p.playerRights = Integer.parseInt(token2);
Some where under there add these two save tokens.
Code:
} else if (token.equals("Used-Pure")) {
p.pure = Integer.parseInt(token2);
} else if (token.equals("Used-Master")) {
p.master = Integer.parseInt(token2);
The first one is for the pure command and the second one is for the master command.
Put those tokens under a spot were you world like here is and example of a players file and what it would look like if you put it under rights.
Code:
[ACCOUNT]
character-username = username
character-password = password
[CHARACTER]
character-height = 0
character-posx = 3094
character-posy = 3469
character-rights = 0
Used-Pure = 0
Used-Master 0
crystal-bow-shots = 0
skull-timer = 0
magic-book = 0
brother-info = 0 0
brother-info = 1 0
brother-info = 2 0
brother-info = 3 0
brother-info = 4 0
brother-info = 5 0
special-amount = 1.0
selected-coffin = 0
barrows-killcount = 0
teleblock-length = 0
pc-points = 0
isDonator = 0
slayerTask = 0
taskAmount = 0
magePoints = 0
autoRet = 0
barrowskillcount = 0
flagged = false
wave = 0
gwkc = 0
fightMode = 0
void = 0 0 0 0 0
IF you don't like how that looks move the token down or up in PlayerSave.java.
I know this is basic please don't flame this is just made to help some kids out.
If you get an error please post below.