Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 04-22-2007, 07:02 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
Reply


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 10:19 AM.


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