PDA

View Full Version : staff gui modes


xAndrewx
10-16-2007, 08:43 PM
so I made a staff tool that looks like this. Simply edit the "this.tools" part, it's also staff locked [clientr.staff]


function onActionServerside(action, mPos) {
if (temp.action == "layobject") {
if (clientr.staff == false) {
return false;
}

putnpc2(temp.mPos[0], temp.mPos[1], "join " @ client.staffAction @ ";");
}
}

//#CLIENTSIDE
function onCreated() {
this.tools = {
//Name, Image, Classname
{"Pumpkin", "era_pumpkin2.gif", "pumpkin"},
{"Candy", "era_hallowcandy1.gif", "hallowcandy"},
};
this.drawMenu();
}

function drawMenu() {
showpoly(200, {(screenwidth - 50),0, screenwidth,0, screenwidth,(this.tools.size() * 32) + 5, (screenwidth - 50),(this.tools.size() * 32) + 5});
changeimgvis(200, 4);
changeimgcolors(200, 0, 0, 0, 1);

for (temp.tool: this.tools) {
temp.yPos = (temp.ind * 32);
showimg(202 + temp.ind, temp.tool[1], (screenwidth - 45), temp.yPos);
changeimgvis(202 + temp.ind, 5);

this.bPos.add({temp.ind, temp.yPos});
temp.ind++;
}
}

function onMouseDown() {
if (params[0] != "left") {
if (client.staffAction != false) {
player.chat = "No object selected!";
client.staffAction = false;
}
return false;
}

if (!(mousescreenx in |screenwidth - 45, screenwidth|)) {
if (client.staffAction == false) {
return false;
}
triggerserver("weapon", this.name, "layobject", {mousex, mousey});
return false;
}
for (temp.i: this.bPos) {
if (mousescreeny in |(temp.i[0] * 32), (temp.i[1] + 32)|) {
player.chat = "Selected" SPC this.tools[temp.i[0]][0];
scheduleevent(0.05, "DrawImage", this.tools[temp.i[0]][1]);

client.staffAction = this.tools[temp.i[0]][2];
break;
}
}
}

function onDrawImage(img) {
(temp.img == false? hideimg(201): showimg(201, temp.img, (mousex - 1.5), (mousey - 1.5)));
changeimgvis(201, 3);

if (temp.img != false) {
scheduleevent(0.05, "DrawImage", (client.staffAction != false? temp.img: false));
}
}


here's a snapshot