PDA

View Full Version : Espeon/z508 ::setlevel command



Wise Old Man
June 22nd, 2010, 17:11
if (cmd[0].equals("setlevel")) {

for (int e : p.equipment) {
if (e != -1) {
p.getActionSender().sendMessage(p, "You cannot be wearing any armour while changing stats.");
return;
}
}
if (p.wildernessZone(p.absX, p.absY)) {
p.getActionSender().sendMessage(p, "You cannot use this command in the wilderness.");
return;
}
if (p.attackedBy != null) {
p.getActionSender().sendMessage(p, "You cannot use this command while in combat.");
return;
}
if (Integer.parseInt(cmd[1]) == 3 && Integer.parseInt(cmd[2]) < 10) {
p.message("You're hitpoints level cannot be under 10.");
return;
}
if (Integer.parseInt(cmd[1]) > 23) {
p.message("There is only 23 Skills that you can raise.");
return;
}
if (Integer.parseInt(cmd[2]) > 99) {
p.message("The max level you can set is 99.");
return;
}
p.skillLvl[Integer.parseInt(cmd[1])] = Integer.parseInt(cmd[2]);
p.skillXP[Integer.parseInt(cmd[1])] = getXPForLevel(Integer.parseInt(cmd[2]));
p.getActionSender().setSkillLvl(p, Integer.parseInt(cmd[1]));
p.message("You succesfuly raise your Skill Lvl.");
}

XxBryantD
June 22nd, 2010, 17:14
looks good but im not much of 508 guy

owner lorenzo
June 22nd, 2010, 17:21
Simple but usefull

Trey
June 22nd, 2010, 18:10
You called Integer.parseInt(cmd[1]) like 5 separate times, just call it once and save the value, same with Integer.parseInt(cmd[2]).

Ninga Nun
June 23rd, 2010, 07:23
Nice, but i need one for 317 lol imma look more cause i cant find one, then when i do its 508 grrrr lol XD

Wise Old Man
June 23rd, 2010, 19:13
You called Integer.parseInt(cmd[1]) like 5 separate times, just call it once and save the value, same with Integer.parseInt(cmd[2]).

Thanks :) Will do.

gamerbug
July 6th, 2010, 23:20
Compiling net/com/Roflpvp/*.java
.\net\com\RoflPvp\net\packethandler\Commands.java: 109: cannot find symbol
symbol : method getXPForLevel(int)
location: class net.com.RoflPvp.net.packethandler.Commands
p.skillXP[Integer.parseInt(cmd[1])] = getXPForLe
vel(Integer.parseInt(cmd[2]));
^
1 error
Press any key to continue . . .


Help?

Karbon
October 27th, 2010, 08:19
Compiling net/com/Roflpvp/*.java
.\net\com\RoflPvp\net\packethandler\Commands.java: 109: cannot find symbol
symbol : method getXPForLevel(int)
location: class net.com.RoflPvp.net.packethandler.Commands
p.skillXP[Integer.parseInt(cmd[1])] = getXPForLe
vel(Integer.parseInt(cmd[2]));
^
1 error
Press any key to continue . . .


Help?
I have the same problem.

Smudge
November 2nd, 2010, 03:32
This isn't a tutorial, more of a snippet.

jessewhitley
January 8th, 2011, 17:58
heres mine for codeusa if it helps


if (cmd[0].equals("setlevel")) {
if (!noEquipment(p)) {
p.getActionSender().sendMessage(p, "You must wear nothing to use this command.");
return;
}
if (Integer.parseInt(cmd[1]) > 23 || Integer.parseInt(cmd[1]) < 0) {
p.getActionSender().sendMessage(p, "First number - skill ID, 0-23, e.g.: ::lvl 10 99");
return;
}
if (Integer.parseInt(cmd[2]) < 1) {
p.getActionSender().sendMessage(p, "You cannot go under level 1.");
return;
}
if (Integer.parseInt(cmd[2]) > 99) {
p.getActionSender().sendMessage(p, "You cannot go higher then 99.");
return;
}
p.skillLvl[Integer.parseInt(cmd[1])] = Integer.parseInt(cmd[2]);
p.skillXP[Integer.parseInt(cmd[1])] = getXPForLevel(Integer.parseInt(cmd[2]));
p.getActionSender().setSkillLvl(p, Integer.parseInt(cmd[1]));
p.appearanceUpdateReq = true;
p.updateReq = true;
}