Menu
Hello, i got this javascript :
[code]$(document).keyup(function(e){
if(e.which==69){
for(var i in g.npc){
if ((Math.abs(hero.rx – g.npc[i].x) <= 1 && Math.abs(hero.ry – g.npc[i].y) <= 1) && (g.npc[i].type == 2 || g.npc[i].type == 3)){
message(‘id: “‘+g.npc[i].nick+'”‘);
_g(“reg&a=name&auto=1&id=-“+i);
break;
}
}
}
});
This javascript is used when key “E” pressed, i need add 5000 milisecound sleep to that function ( even if I press the E key a few times in a row, the function will be executed only once in 5000 milliseconds).
I tried do that with setTimeout, but can’t
Can someone help me?
Thanks