Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Staff System (https://forums.graalonline.com/forums/showthread.php?t=73524)

Chandler 04-16-2007 09:55 PM

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!

cbk1994 04-22-2007 07:02 PM

Nice, though you could make it so if you hold shift and right click a block, it destroys it. Also a way to set the blocks chat would be nice.

Overall, nice. I like the concept of holding shift for boots, though personally I just mouse warp everywhere.


All times are GMT +2. The time now is 09:34 PM.

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