PDA

View Full Version : Staff System


Chandler
04-16-2007, 10:55 PM
Contains staff boots and a block placer.

The Block: (object_block)


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)


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, 08: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.