Originally Posted by
Faris
That's because you can't call stop from outside of the event, every client had tens of events running simultaneously so it would be a pretty dumb system if you could do it how your trying.
Here's what you do. In wherever your trying to stop it, change a Boolean to false instead.
Now in the main body of the event, have it check for if that Boolean is not false before continuing... If it is = false then call container.stop();
Code:
Server.getTaskScheduler().schedule(new Task(3, false) {
int cycle = amount;
@Override
protected void execute() {
if (c.disconnected) {
stop();
return;
}
if (c.isCookin = false) {
stop();
return;
}
c.startAnimation(c.playerSkillProp[7][5] == 2732 ? 897 : 896);
if (!c.playerHasItem(c.oldItem, 1) || !c.checkTask(task)) {
stop();
c.resetPlayerSkillVariables();
c.stopPlayerSkill = true;
return;
}
c.stopPlayerSkill = true;
c.deleteItem(c.oldItem, 1);
if (c.playerLevel[7] >= fishStopsBurning(c, c.oldItem) || Misc.random(cookChance(c)) > Misc.random(c.levelReq)) {
c.sM("You successfully cook the " + c.getItemName(c.oldItem).toLowerCase() + ".");
c.addSkillXP(c.gainXp, 7);
c.addItem(c.newItem2, 1);
} else {
c.sM("Oops! You accidentally burnt the " + c.getItemName(c.oldItem).toLowerCase() + "!");
c.addItem(c.newItem, 1);
}
cycle--;
if (cycle < 1) {
c.isCookin = false;
stop();
c.resetPlayerSkillVariables();
return;
}
}
});
added something like you said, and the
Code:
if(isCookin = true) {
isCookin = false;
}
and still didnt fix it
But so there is no way i can stop a task/event away outside the task/event