Thread: Staff System
View Single Post
  #1  
Old 04-16-2007, 09:55 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Staff System

Contains staff boots and a block placer.

The Block: (object_block)

HTML Code:
function onCreated()
{
  this.setShape(1, 32, 32);
  this.setImg("block.png");
}

function onPlayerChats()
{
  if (player.account == this.blockOwner)
  {
    if (player.chat == "destroy")
    {
      this.destroy();
    }
  }
}

Here's the weapon: (Doesn't need a specific name)

HTML Code:
function onActionServerside(currentOption)
{
  if (!clientr.staff)
  {
    return false;
  }
  switch(temp.currentOption)
  {
    case "dropBlock":
      with(putnpc2(params[1][0], params[1][1], "join object_block;"))
      {
        this.blockOwner = playero.account;
      }
    break;
  }
}
//#CLIENTSIDE
function onKeyPressed(letterCode, letterKey)
{
  switch(temp.letterCode)
  {
    case 160:
    case 220:
      setTimer(0.05);
    break;
  }
}

function onTimeout()
{
  if (!clientr.staff)
  {
    return false;
  }
  this.showingBlock = false;
  temp.doTimeout = true;   
  if (keydown2(160, true))
  {
    for (temp.keyDown = 0; temp.keyDown < 4; temp.keyDown++) 
    {
      if (keydown(temp.keyDown)) 
      {
        player.x += vecx(temp.keyDown);
        player.y += vecy(temp.keyDown);
      }
    }
  }
   else
  if (keydown2(220, true))
  {
    this.showingBlock = true;
    showimg(300, "block.png", (mousex - 1), (mousey - 1));
    changeimgvis(300, 3);
  }
   else
  {
    temp.doTimeout = false;
  }
  
  if (!this.showingBlock)
  {
    hideimg(300);
  }
  
  if (temp.doTimeout)
  {
    setTimer(0.05);
  }
}
function onMouseDown(mouseMode)
{
  if (temp.mouseMode == "left")
  {
    if (this.showingBlock)
    {
      triggerserver("weapon", this.name, "dropBlock", {(mousex - 1), (mousey - 1)});
    }
  }
}
Simple, hold the shift key for boots, press and hold the "\" key for a block to appear, once the block has appeared, if you are to click the left mouse button, it'll then drop that block in that position!

You need the flag "clientr.staff=1" for this to work!
Reply With Quote