Nearly ready for release, but my server can't be released without the option to equip/unequip, I gave it a shot but I press D, it switchs to punch, i punch then i press S again and the player attacks with an invisible sword??
Weapons/Test D Unequip
PHP Code:
thiso.weapontabs = {"Weapons"};
this.image = "pa_mud-maceofthedead.png";
function onActionServerside(option) {
if (temp.option == "onAttack") {
player.doAttack("Sword", 6, 2, player.account);
}
if (temp.option == "equip") {
clientr.mudweapon = this.name;
echo("Weapon Equiped");
}
if (temp.option == "unequip") {
clientr.mudweapon = "+Fists/Punch";
echo("Weapon Unequiped");
}
}
//#CLIENTSIDE
function GraalControl.onKeyDown(code, key) {
if (key == "s" && player.weapon == this && ! this.d && clientr.mudweapon != this.name) {
this.d = true;
player.attr[2] = "pa_mace-ofthedead.png";
triggerserver("gui", this.name, "equip");
}
if (key == "s" && player.weapon == this && ! this.d && clientr.mudweapon == this.name) {
this.onTimeOut();
this.d = true;
}
if (key == "d" && player.weapon == this && ! this.d && clientr.mudweapon == this.name) {
triggerserver("gui", this.name, "unequip");
}
}
function onTimeOut() {
if (player.weapon != this) {
return;
}
setani("pa_maceattack", "");
freezeplayer(0.25);
triggerserver("weapon", this.name, "onAttack");
replaceani("pa_scythewalk","pa_macewalk");
replaceani("pa_scytheidle","pa_maceidle");
if (this.isAutomatic) {
this.setTimer(this.sleepTime);
}
}
function GraalControl.onKeyUp(code, key) {
if (key == "s" && player.weapon == this && clientr.mudweapon == this.name) {
this.setTimer(0);
this.d = false;
}
}
+Fists/Punch
PHP Code:
function onActionServerside(option) {
if (temp.option != "onAttack") return;
player.doAttack("Punch", 1, 1);
}
//#CLIENTSIDE
function GraalControl.onKeyDown(code, key) {
if (key == "s" && ! this.d && clientr.mudweapon == this) {
this.onTimeOut();
this.d = true;
player.attr[2] = "";
}
}
function onTimeOut() {
setani("pa_punch", "");
freezeplayer(0.25);
triggerserver("weapon", this.name, "onAttack");
if (this.isAutomatic) {
this.setTimer(this.sleepTime);
}
}
function GraalControl.onKeyUp(code, key) {
if (key == "s" && clientr.mudweapon == this) {
this.setTimer(0);
this.d = false;
}
}