Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Triggeraction from weapon to putnpc2- NPC (https://forums.graalonline.com/forums/showthread.php?t=134264183)

Adddeeee 08-11-2011 08:20 PM

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);
    }
  } 
} 


cbk1994 08-11-2011 11:19 PM

PHP Code:

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

should be

PHP Code:

function onActionDeleteBlock() 
{ 
  
this.destroy(); 
} 

You should probably also verify that the player is authorized to delete the block on serverside.


All times are GMT +2. The time now is 01:38 PM.

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