PDA

View Full Version : [Hyperion] Delays



Mario
June 26th, 2010, 20:48
How do I add a delay to this code:


if(npc.getDefinition().getId() == 2234) {
player.playAnimation(Animation.create(881, 0));
player.getInventory().add(new Item(995, 1000));
return;
}

Like ATM it just keeps giving 1k cash, I want it to have a delay in it (so you can't spamm to get rich fast).

Mario
June 27th, 2010, 08:56
Bump.

Canownueasy`
June 27th, 2010, 09:02
switch(npc.getDefinition().getId()) {
case 2234:
if(player.needsWait) {
return;
}
player.needsWait = true;
player.playAnimation(Animation.create(881, 0));
player.getInventory().add(new Item(995, 1000));
World.getWorld().submit(new Event(3000) {
public void execute() {
player.needsWait = false;
stop();
}
});
break;
}

Also in Player:

public boolean needsWait;

BTW you just proved your project is going to fail :p

Mario
June 27th, 2010, 09:10
No it's not ;p Have a lil trust please :D? Anyway, joined your group cuz IMO you keep helping people and never hate unless they hate on you...
And thanks for the help ;p