View Single Post
  #1  
Old 08-11-2011, 08:20 PM
Adddeeee Adddeeee is offline
Registered User
Join Date: Aug 2011
Posts: 30
Adddeeee is on a distinguished road
Triggeraction from weapon to putnpc2- NPC

Hi! (again)

Sorry for yet another new thread, but it seems as if I'm stuck again!

I'm trying to do a staffblock. The idea is that when you left-click the mouse a staffblock will appear with the current player.chat set as it's own chat. When you right-click the mouse the block shall be destroyed.

Can't seem to locate where I go wrong.

Class:

PHP Code:
function onCreated()
{
  
setShape(1, 32, 32);
  
setimg( "block.png" );
}

function 
onDeleteBlock()
{
  
this.destroy();
} 
Weapon:

PHP Code:
function onActionServerSide(x, y)
{
  
temp.npc = putnpc2(x - 1, y - 1, "");
  
temp.npc.join("staffblock");
  
temp.npc.chat = player.chat;
}

//#CLIENTSIDE
function onMouseDown()
{
  if(
player.weapon == this)
  {
    if(
leftmousebutton)
    {
      if(
player.weapon == this)
        
triggerserver("weapon", this.name, mousex, mousey);
    }
    
    if(
rightmousebutton)
    {
      
player.chat = mousex SPC mousey;
      
triggeraction(mousex, mousey, "DeleteBlock", null);
    }
  } 
} 
Reply With Quote