alright now last question if I fire the spell fast enough I go into negative values, how can i stop that
PHP Code:
thiso.weapontabs = {"Weapons"};
this.image = "pa_mud-maceofthedead.png";
function onActionServerSide() {
if (params[0] == "removemp") {
clientr.mudmp -= "5";
}
}
//#CLIENTSIDE
function GraalControl.onKeyDown(code, key) {
if (key == "d" && player.weapon == this && ! this.d) {
sleep(0.1);
this.onTimeOut();
this.d = true;
player.attr[2] = "";
}
}
function onTimeOut() {
if (player.weapon != this) {
return;
}
if (clientr.mudmp >= "7") {
setshootparams("5");
shoot(player.x + vecx(player.dir), player.y + vecy(player.dir), playerz, (playerdir + 1) * pi / 2 + random( -0.2, 0.2), NULL, NULL, "islayer_earthspell", 2);
play("shock.wav");
triggerserver("gui",this.name,"removemp");
}
}
function GraalControl.onKeyUp(code, key) {
if (key == "d" && player.weapon == this) {
this.setTimer(0);
this.d = false;
}
}