Hi i need help title says all. heres my script
PHP Code:} else if (splitted[0].equals("killmap")) {
for (MapleCharacter mch : player.getMap().getCharacters()) {
mch.setHp(0);
mch.updateSingleStat(MapleStat.HP, 0);
}
Printable View
Hi i need help title says all. heres my script
PHP Code:} else if (splitted[0].equals("killmap")) {
for (MapleCharacter mch : player.getMap().getCharacters()) {
mch.setHp(0);
mch.updateSingleStat(MapleStat.HP, 0);
}
Hey, in your code you have a for loop which iterates over the collection of characters in your map. In other words, all characters will be killed. To prevent this you exclude gm characters by adding a check in your loop:
if (!mch.isGm()) {
// set hp 0 here
}
Or if you use java 8, replace your for loop with a stream and exclude gms from it.
Code:} else if (splitted[0].equals("killmap")) {
for (MapleCharacter mch : player.getMap().getCharacters()) {
if (!mch.isGm()) {
mch.setHp(0);
mch.updateSingleStat(MapleStat.HP, 0);
}
}
Take a look in your source files before copy-pasting anything.
If the above doesn't work, try using the gmLevel() method (or anyting that resembles that).
You could alternatively exclude gmLevels 1 to 5 if you change the the operator and condition to < number.PHP Code:if(mch.gmLevel() == 0) {
}