Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-15-2007, 07:41 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Sign drop / Staff Block

Quick weapon I made for Ducati. I figured someone might like it / use it .

This goes in a weapon
PHP Code:
// Twinny's sign dropper
function onActionServerSide()
{
  if (
params[0] == "layblock")
  {
    
temp.npc putnpc2(params[1], params[2], "join(\"staffsign\");");
    
temp.npc.owner player.account;
  }
}    

//#CLIENTSIDE
function onCreated()
  
setTimer(0.05);

function 
onKeyPressed(num1codenum2)
{
  if (
code == "b")
    
this.block = !this.block;  //Toggles on and off
}

function 
onTimeout()
{
  if (
this.block)
    
showimg(1"block.png"mousexmousey);
  else
    
hideimg(1);
  
setTimer(0.05);
}

function 
onMouseDown(mode)
{
    if (
mode == "left")
    {
      if (
this.block)    
        
triggerserver("gui"this.name"layblock"mousexmousey);
    }
    else if (
mode == "double")
      
triggeraction(mousexmousey"SetMsg"player.chat);
    else if (
mode == "right")
      
triggeraction(mousexmousey"KillSign""");

and this goes in a class named staffsign
PHP Code:
function onCreated()
{
  
setimg("block.png"); //Replace with what you want
  
this.chat "Placed by "@this.owner;
  
sleep(2);
  
this.chat "";
}

function 
onActionSetMsg(msg)
  
this.chat msg;

function 
onActionKillSign()
  
destroy(); 
Pretty straight forward. To turn it on, press b. While it is on, left click somewhere to drop a sign / staffblock. To set a message, say something then double click the dropped sign/block to set its text. right click to destroy it. The weapon doesn't need to be on to set a message or destroy it.
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 02:02 PM.


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