Oh okay, so what I should do if I want every staff linked to a rank number :/
Oh okay, so what I should do if I want every staff linked to a rank number :/
:O how can I add player attributes? then select it when I wants?
player.clientr.staffrank = "Manager";
etc.
You can also tokenize the SO and separate it with the ranks between [Rank].
-Johnaudi
So I select each staff with server option then I set them a rank with player.clientr.staffrank in a class that I call in each weapon?
But what feels good? :P Well, Finally I did it on my way so now I made staff tools using an array to make the script easier but how can I set a function for each onAction button: here is my script:
PHP Code:
this.join("staffmembers");
function onActionServerSide(tooltabs) {
if(staffMembers(player.account))
{
if(isStaffMember(player.account)[0])
{
echo("Staff Tools gave to:");
echo(player.account);
for (temp.i = 0; i < tooltabs.size(); i++)
{
if(isStaffMember(player.account)[1] >= tooltabs[i][4])
{
player.addweapon(tooltabs[i][2]);
}
else{
player.removeweapon(tooltabs[i][2]);
}
}
}
}
}
//#CLIENTSIDE
function showStaffToolWindow(stafftooltabs){
//Echo Window
StaffToolsWindow.show();
new GuiControl("StaffToolsWindow") {
wSTW = screenwidth - 100;
useownprofile = true;
profile.opaque = true;
profile.border = 1;
profile.borderColor = "0 0 0";
profile.fillColor = "57 57 57";
extent = "100 405";
position = {wSTW,0};
canMove = true;
canResize = canMaximize = canClose = false;
alpha = .8;
new GuiControl("StaffToolsWindowTitle") {
useownprofile = true;
profile.opaque = true;
profile.border = 1;
profile.borderColor = "0 0 0";
profile.fillColor = "37 37 37";
position = "0 0";
extent = "100 40";
canResize = canMaximize = canClose = canMove = false;
new GuiTextCtrl("StaffToolsWindowTitleText") {
useownprofile = true;
profile.fontColor = "255 255 255";
profile.fontSize = 16;
profile.justify = "center";
position = "0 10";
width = 100;
height = 20;
text = "Staff Tools";
}
}
yValue = 15;
for (temp.i = 0; i < stafftooltabs.size(); i++)
{
yValue += 35;
new GuiButtonCtrl(stafftooltabs[i][0]) {
profile = GuiBlueButtonProfile;
x = 10;
y = yValue;
width = 80;
height = 30;
text = stafftooltabs[i][1];
echo(stafftooltabs[i][0], yValue, stafftooltabs[i][1]);
}
}
}
//Window End
}
function onCreated()
{
//Array: Id, Name, Weapon, Image, Rank Needed
this.stafftool = {
{0,"Boots","-Staff/Boots","boots",1},
{1,"Stick","-Staff/Stick","stick",1},
{2,"Drag","-Staff/Drag","drag",1},
{3,"Stealth","-Staff/Stealth","stealth",1},
{4,"StaffCmd","-Staff/Cmd","staffcmd",1},
{5,"StaffEffects","-Staff/Effects","staffeffect",1},
{6,"StaffTag","-Staff/Tag","stafftag",1},
{7,"TileEditor","-Staff/TileEditor","tileeditor",8},
{8,"NpcEditor","-Staff/NPCEditor","npceditor",9},
{9,"SQLEditor","-Staff/SQLExplorer","sqleditor",10}
};
//Add Tools to Staff
//triggerserver("weapon", this.name, this.stafftool);
//Show Staff Tools Window
showStaffToolWindow(this.stafftool);
}
Use thiso.catchevent(this, "onAction", "onFncName");
-Johnaudi
Thank you much You are always here to help
Another problem, why that don't work with thiso.catchevent:
PHP Code:
this.join("staffmembers");
function onActionServerSide(tooltabs) {
if(staffMembers(player.account))
{
if(isStaffMember(player.account)[0])
{
echo("Staff Tools gave to:");
echo(player.account);
for (temp.i = 0; i < tooltabs.size(); i++)
{
if(isStaffMember(player.account)[1] >= tooltabs[i][4])
{
player.addweapon(tooltabs[i][2]);
}
else{
player.removeweapon(tooltabs[i][2]);
}
}
}
}
}
//#CLIENTSIDE
function onCreated()
{
//Array: Id, Name, Weapon, Image, Rank Needed
this.stafftool = {
{0,"Boots","-Staff/Boots","boots",1},
{1,"Stick","-Staff/Stick","stick",1},
{2,"Drag","-Staff/Drag","drag",1},
{3,"Stealth","-Staff/Stealth","stealth",1},
{4,"StaffCmd","-Staff/Cmd","staffcmd",1},
{5,"StaffEffects","-Staff/Effects","staffeffect",1},
{6,"StaffTag","-Staff/Tag","stafftag",1},
{7,"TileEditor","-Staff/TileEditor","tileeditor",8},
{8,"NpcEditor","-Staff/NPCEditor","npceditor",9},
{9,"SQLEditor","-Staff/SQLExplorer","sqleditor",10}
};
//Add Tools to Staff
//triggerserver("weapon", this.name, this.stafftool);
//Show Staff Tools Window
showStaffToolWindow(this.stafftool);
}
function showStaffToolWindow(stafftooltabs){
//Echo Window
StaffToolsWindow.show();
new GuiControl("StaffToolsWindow") {
wSTW = screenwidth - 100;
useownprofile = true;
profile.opaque = true;
profile.border = 1;
profile.borderColor = "0 0 0";
profile.fillColor = "57 57 57";
extent = "100 405";
position = {wSTW,0};
canMove = true;
canResize = canMaximize = canClose = false;
alpha = .8;
new GuiControl("StaffToolsWindowTitle") {
useownprofile = true;
profile.opaque = true;
profile.border = 1;
profile.borderColor = "0 0 0";
profile.fillColor = "37 37 37";
position = "0 0";
extent = "100 40";
canResize = canMaximize = canClose = canMove = false;
new GuiTextCtrl("StaffToolsWindowTitleText") {
useownprofile = true;
profile.fontColor = "255 255 255";
profile.fontSize = 16;
profile.justify = "center";
position = "0 10";
width = 100;
height = 20;
text = "Staff Tools";
}
}
paramsY = 15;
for (temp.i = 0; i < stafftooltabs.size(); i++)
{
paramsY += 35;
new GuiButtonCtrl("StaffToolsWindowButton_" @ stafftooltabs[i][3]) {
profile = GuiBlueButtonProfile;
x = 10;
y = paramsY;
width = 80;
height = 30;
text = stafftooltabs[i][1];
getID = stafftooltabs[i][0];
getWeapon = stafftooltabs[i][2];
thiso.catchevent(this, "onAction", "onToolsButtonAction");
}
}
}
//Window End
}
function onToolsButtonAction(obj,stafftool)
{
for (temp.i = 0; i < stafftool.size(); i++)
{
if(stafftool[i][0] == obj.getID)
{
if((obj.getWeapon).isOpen()){
player.chat = obj.text SPC ": On";
(obj.getWeapon).close();
}
else{
player.chat = obj.text SPC ": Off";
(obj.getWeapon).open();
}
}
}
}