View Single Post
  #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