Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-19-2010, 02:02 PM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
Equip/Unequip Weapons

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"62player.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(codekey) {
    if (
key == "s" && player.weapon == this && ! this.&& clientr.mudweapon != this.name) {
    
this.true;
    
player.attr[2] = "pa_mace-ofthedead.png";
    
triggerserver("gui"this.name"equip");
    }
    if (
key == "s" && player.weapon == this && ! this.&& clientr.mudweapon == this.name) {
    
this.onTimeOut();
    
this.true;
    }
    if (
key == "d" && player.weapon == this && ! this.&& 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(codekey) {
  if (
key == "s" && player.weapon == this && clientr.mudweapon == this.name) {
    
this.setTimer(0);
    
this.false;
  }

+Fists/Punch
PHP Code:
function onActionServerside(option) {
  if (
temp.option != "onAttack") return;
  
  
player.doAttack("Punch"11);
}

//#CLIENTSIDE

function GraalControl.onKeyDown(codekey) {
  if (
key == "s" && ! this.&& clientr.mudweapon == this) {
    
this.onTimeOut();
    
this.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(codekey) {
  if (
key == "s" && clientr.mudweapon == this) {
    
this.setTimer(0);
    
this.false;
  }

__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:28 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.