Post: Help with arrays...need someone who understands GSC files
02-15-2012, 03:08 PM #1
Kearney158
Bounty hunter
(adsbygoogle = window.adsbygoogle || []).push({}); Hey,

First of all, here is the menu base I'm using...its IVI40A3Fusionz‎'s one.


    

BuildMenu()
{
self endon("disconnect");
self endon("unverified");
self.MenuOpen = false;
self thread iniMenu();
self.Menu["Background"] = CreateShader("CENTER", "CENTER", 550, 0, 390, 1000, (0,0,0), "white", 0, 1);
self.Menu["Scrollbar"] = CreateShader("CENTER", "CENTER", 550, -160, 390, 20, (1,0,0), "white", 1, 1);
for(;Winky Winky
{
if(self FragButtonPressed() && self.MenuOpen == false)
{
self freezecontrols(true);
self.Menu["Scrollbar"] MoveElem("x", 1, 250);
self.Menu["Background"] MoveElem("x", 1, 250);
self thread MenuText("Main");
self.Menu["MenuText"] MoveElem("x", 1, 60);
self.Menu["Title"] MoveElem("x", 1, 180);
wait 1;
self.Menu["Cursor"] = 0;
self.Menu["Scrollbar"] MoveElem("y", .3, self.Menu["Cursor"]*24-160);
self.MenuOpen = true;
wait .1;
}
if(self UseButtonPressed() && self.MenuOpen == true)
{
if(self.Root == "PlayerM") self.PlayerFunctions = self.Menu["Cursor"];
self thread [[self.MenuFunction[self.Root][self.Menu["Cursor"]]]](self.MenuInput[self.Root][self.Menu["Cursor"]]);
wait .2;
}
if(self AdsButtonPressed() && self.MenuOpen == true)
{
self.Menu["Cursor"]--;
if(self.Menu["Cursor"]>self.MenuText[self.Root].size-1) self.Menu["Cursor"]=0;
if(self.Menu["Cursor"]<0) self.Menu["Cursor"]=self.MenuText[self.Root].size-1;
self.Menu["Scrollbar"] MoveElem("y", .3, self.Menu["Cursor"]*24-160);
wait .2;
}
if(self AttackButtonPressed() && self.MenuOpen == true)
{
self.Menu["Cursor"]++;
if(self.Menu["Cursor"]>self.MenuText[self.Root].size-1) self.Menu["Cursor"]=0;
if(self.Menu["Cursor"]<0) self.Menu["Cursor"]=self.MenuText[self.Root].size-1;
self.Menu["Scrollbar"] MoveElem("y", .3, self.Menu["Cursor"]*24-160);
wait .2;
}
if(self MeleeButtonPressed() && self.MenuOpen == true)
{
if(self.Root == "Main")
{
self.Menu["Scrollbar"] MoveElem("x", 1, 550);
self.Menu["Background"] MoveElem("x", 1, 550);
self.Menu["MenuText"] MoveElem("x", .985, 350);
self.Menu["Title"] MoveElem("x", .985, 450);
wait 1;
self.Menu["MenuText"] destroy();
self.Menu["Title"] destroy();
self freezecontrols(false);
self.MenuOpen = false;
}
else if(self.Root == "SubM1" || self.Root == "SubM2" || self.Root == "SubM3" || self.Root == "SubM4" || self.Root == "SubM5" || self.Root == "VIPM" || self.Root == "PlayerM" || self.Root == "AdminM" || self.Root == "HostM")
{
self thread NewMenu("Main");
}
else if(self.Root == "PlayerOpts")
{
self thread NewMenu("PlayerM");
}
wait .2;
}
wait 0.05;
}
}
CreateShader(align,relative,x,y,width,height,color,shader,sort,alpha)
{
CShader=newClientHudElem(self);
CShader.children=[];
CShader.elemType="bar";
CShader.sort=sort;
CShader.color=color;
CShader.alpha=alpha;
CShader setParent(level.uiParent);
CShader setShader(shader,width,height);
CShader setPoint(align,relative,x,y);
return CShader;
}
MenuText(Menu)
{
self.Root = Menu; ///////
Text = "";
for( i=0;i<self.MenuText[Menu].size;i++ ) Text += self.MenuText[Menu][i]+"\n";
self.Menu["MenuText"] = createFontString("hud_small", 2, self);
self.Menu["MenuText"] setPoint("LEFT", "", 350, -160);
self.Menu["MenuText"] setText( Text );
self.Menu["MenuText"].alpha = 6;
self.Menu["MenuText"].sort = 15;
self.Menu["Title"] = createFontString("hud_small", 2.5, self);
self.Menu["Title"] setPoint("CENTER", "", 450, -200);
self.Menu["Title"] setText( self.TitleText[Menu] );
self.Menu["Title"].alpha = 6;
self.Menu["Title"].sort = 15;
}
addMenu(Menu, Title)
{
self.TitleText[Menu] = Title;
}
addOption(Menu, Number, Text, Function, Input)
{
self.MenuText[Menu][Number] = Text;
self.MenuFunction[Menu][Number] = Function;
if(IsDefined(Input)) self.MenuInput[Menu][Number] = Input;
}
MoveElem(Axis, Time, Input)
{
self MoveOverTime(Time);
if(Axis == "x") self.x = Input;
else self.y = Input;
}
NewMenu(Menu)
{
self.Menu["MenuText"] destroy();
self.Menu["Title"] destroy();
self thread MenuText(Menu);
self.Menu["MenuText"].x = 60;
self.Menu["Title"].x = 180;
self.Menu["Cursor"] = 0;
self.Menu["Scrollbar"] MoveElem("y", .3, self.Menu["Cursor"]*24-160);
}
MonitorPlayers()
{
self endon("disconnect");
for(;Winky Winky
{
for(p = 0;p < level.players.size;p++)
{
player = level.players[p];
self.MenuText["PlayerM"][p] = player.name;
self.MenuFunction["PlayerM"][p] = ::NewMenu;
self.MenuInput["PlayerM"][p] = "PlayerOpts";
wait .01;
}
wait .5;
}
}
iniMenu()
{
addMenu("Main", "Main Menu");
if(self.Verified == true)
{
addOption("Main", 0, "Sub Menu 1", ::NewMenu, "SubM1");
addOption("Main", 1, "Sub Menu 2", ::NewMenu, "SubM2");
addOption("Main", 2, "Sub Menu 3", ::NewMenu, "SubM3");
addOption("Main", 3, "Sub Menu 4", ::NewMenu, "SubM4");
addOption("Main", 4, "Sub Menu 5", ::NewMenu, "SubM5");
}
if(self.VIP == true)
{
addOption("Main", 5, "VIP Menu", ::NewMenu, "VIPM");
}
if(self.Admin == true)
{
addOption("Main", 6, "Player Menu", ::NewMenu, "PlayerM");
addOption("Main", 7, "Admin Menu", ::NewMenu, "AdminM");
}
if(self GetEntityNumber() == 0)
{
addOption("Main", 8, "Host Menu", ::NewMenu, "HostM");
}

addMenu("SubM1", "Sub Menu 1");
addOption("SubM1", 0, "Sub Option 1", ::Test, "1");
addOption("SubM1", 1, "Sub Option 2", ::Test, "2");
addOption("SubM1", 2, "Sub Option 3", ::Test, "3");
addOption("SubM1", 3, "Sub Option 4", ::Test, "4");
addOption("SubM1", 4, "Sub Option 5", ::Test, "5");

//////////////////////
/////////////////////////////
/////////////////////////// I deleted sub-menu's just to keep this shorter
////////////////////////////
/////////////////////////



Verify()
{
player = level.players[self.PlayerFunctions];
if(player GetEntityNumber() == 0)
{
self iPrintln("^1"+level.hostname+" Cannot Be Un-Verified!");
}
else
{
if(player.Verified == false || player.VIP == false || player.Admin == false)
{
player.Verified = true;
player.VIP = false;
player.Admin = false;
player thread BuildMenu();
}
else if(player.Verified == true || player.VIP == true || player.Admin == true)
{
player notify("unverified");
player.Verified = false;
player.VIP = false;
player.Admin = false;
}
}
self thread NewMenu("PlayerM");
}


So the problem is that I'm getting a bit confused over how some of the functions work such as;
MenuText(Menu)
addMenu(Menu, Title)
addOption(Menu, Number, Text, Function, Input)
NewMenu(Menu)

Im not totally confused its just when it comes to the whole array[] thing I just get lost. So could anyone maybe link me to any good tutorials that explain this well or even try your best to explain it to me.



I also want to know how to delete an array and every variable in it, do you have to list every variable in the array using a for loop and then destroy() them? Please advise

Thanks for any help
(adsbygoogle = window.adsbygoogle || []).push({});
02-15-2012, 03:28 PM #2
xRaW
xI2aW-
Originally posted by Kearney158 View Post
Hey,

First of all, here is the menu base I'm using...its IVI40A3Fusionz‎'s one.


    

BuildMenu()
{
self endon("disconnect");
self endon("unverified");
self.MenuOpen = false;
self thread iniMenu();
self.Menu["Background"] = CreateShader("CENTER", "CENTER", 550, 0, 390, 1000, (0,0,0), "white", 0, 1);
self.Menu["Scrollbar"] = CreateShader("CENTER", "CENTER", 550, -160, 390, 20, (1,0,0), "white", 1, 1);
for(;Winky Winky
{
if(self FragButtonPressed() && self.MenuOpen == false)
{
self freezecontrols(true);
self.Menu["Scrollbar"] MoveElem("x", 1, 250);
self.Menu["Background"] MoveElem("x", 1, 250);
self thread MenuText("Main");
self.Menu["MenuText"] MoveElem("x", 1, 60);
self.Menu["Title"] MoveElem("x", 1, 180);
wait 1;
self.Menu["Cursor"] = 0;
self.Menu["Scrollbar"] MoveElem("y", .3, self.Menu["Cursor"]*24-160);
self.MenuOpen = true;
wait .1;
}
if(self UseButtonPressed() && self.MenuOpen == true)
{
if(self.Root == "PlayerM") self.PlayerFunctions = self.Menu["Cursor"];
self thread [[self.MenuFunction[self.Root][self.Menu["Cursor"]]]](self.MenuInput[self.Root][self.Menu["Cursor"]]);
wait .2;
}
if(self AdsButtonPressed() && self.MenuOpen == true)
{
self.Menu["Cursor"]--;
if(self.Menu["Cursor"]>self.MenuText[self.Root].size-1) self.Menu["Cursor"]=0;
if(self.Menu["Cursor"]<0) self.Menu["Cursor"]=self.MenuText[self.Root].size-1;
self.Menu["Scrollbar"] MoveElem("y", .3, self.Menu["Cursor"]*24-160);
wait .2;
}
if(self AttackButtonPressed() && self.MenuOpen == true)
{
self.Menu["Cursor"]++;
if(self.Menu["Cursor"]>self.MenuText[self.Root].size-1) self.Menu["Cursor"]=0;
if(self.Menu["Cursor"]<0) self.Menu["Cursor"]=self.MenuText[self.Root].size-1;
self.Menu["Scrollbar"] MoveElem("y", .3, self.Menu["Cursor"]*24-160);
wait .2;
}
if(self MeleeButtonPressed() && self.MenuOpen == true)
{
if(self.Root == "Main")
{
self.Menu["Scrollbar"] MoveElem("x", 1, 550);
self.Menu["Background"] MoveElem("x", 1, 550);
self.Menu["MenuText"] MoveElem("x", .985, 350);
self.Menu["Title"] MoveElem("x", .985, 450);
wait 1;
self.Menu["MenuText"] destroy();
self.Menu["Title"] destroy();
self freezecontrols(false);
self.MenuOpen = false;
}
else if(self.Root == "SubM1" || self.Root == "SubM2" || self.Root == "SubM3" || self.Root == "SubM4" || self.Root == "SubM5" || self.Root == "VIPM" || self.Root == "PlayerM" || self.Root == "AdminM" || self.Root == "HostM")
{
self thread NewMenu("Main");
}
else if(self.Root == "PlayerOpts")
{
self thread NewMenu("PlayerM");
}
wait .2;
}
wait 0.05;
}
}
CreateShader(align,relative,x,y,width,height,color,shader,sort,alpha)
{
CShader=newClientHudElem(self);
CShader.children=[];
CShader.elemType="bar";
CShader.sort=sort;
CShader.color=color;
CShader.alpha=alpha;
CShader setParent(level.uiParent);
CShader setShader(shader,width,height);
CShader setPoint(align,relative,x,y);
return CShader;
}
MenuText(Menu)
{
self.Root = Menu; ///////
Text = "";
for( i=0;i<self.MenuText[Menu].size;i++ ) Text += self.MenuText[Menu][i]+"\n";
self.Menu["MenuText"] = createFontString("hud_small", 2, self);
self.Menu["MenuText"] setPoint("LEFT", "", 350, -160);
self.Menu["MenuText"] setText( Text );
self.Menu["MenuText"].alpha = 6;
self.Menu["MenuText"].sort = 15;
self.Menu["Title"] = createFontString("hud_small", 2.5, self);
self.Menu["Title"] setPoint("CENTER", "", 450, -200);
self.Menu["Title"] setText( self.TitleText[Menu] );
self.Menu["Title"].alpha = 6;
self.Menu["Title"].sort = 15;
}
addMenu(Menu, Title)
{
self.TitleText[Menu] = Title;
}
addOption(Menu, Number, Text, Function, Input)
{
self.MenuText[Menu][Number] = Text;
self.MenuFunction[Menu][Number] = Function;
if(IsDefined(Input)) self.MenuInput[Menu][Number] = Input;
}
MoveElem(Axis, Time, Input)
{
self MoveOverTime(Time);
if(Axis == "x") self.x = Input;
else self.y = Input;
}
NewMenu(Menu)
{
self.Menu["MenuText"] destroy();
self.Menu["Title"] destroy();
self thread MenuText(Menu);
self.Menu["MenuText"].x = 60;
self.Menu["Title"].x = 180;
self.Menu["Cursor"] = 0;
self.Menu["Scrollbar"] MoveElem("y", .3, self.Menu["Cursor"]*24-160);
}
MonitorPlayers()
{
self endon("disconnect");
for(;Winky Winky
{
for(p = 0;p < level.players.size;p++)
{
player = level.players[p];
self.MenuText["PlayerM"][p] = player.name;
self.MenuFunction["PlayerM"][p] = ::NewMenu;
self.MenuInput["PlayerM"][p] = "PlayerOpts";
wait .01;
}
wait .5;
}
}
iniMenu()
{
addMenu("Main", "Main Menu");
if(self.Verified == true)
{
addOption("Main", 0, "Sub Menu 1", ::NewMenu, "SubM1");
addOption("Main", 1, "Sub Menu 2", ::NewMenu, "SubM2");
addOption("Main", 2, "Sub Menu 3", ::NewMenu, "SubM3");
addOption("Main", 3, "Sub Menu 4", ::NewMenu, "SubM4");
addOption("Main", 4, "Sub Menu 5", ::NewMenu, "SubM5");
}
if(self.VIP == true)
{
addOption("Main", 5, "VIP Menu", ::NewMenu, "VIPM");
}
if(self.Admin == true)
{
addOption("Main", 6, "Player Menu", ::NewMenu, "PlayerM");
addOption("Main", 7, "Admin Menu", ::NewMenu, "AdminM");
}
if(self GetEntityNumber() == 0)
{
addOption("Main", 8, "Host Menu", ::NewMenu, "HostM");
}

addMenu("SubM1", "Sub Menu 1");
addOption("SubM1", 0, "Sub Option 1", ::Test, "1");
addOption("SubM1", 1, "Sub Option 2", ::Test, "2");
addOption("SubM1", 2, "Sub Option 3", ::Test, "3");
addOption("SubM1", 3, "Sub Option 4", ::Test, "4");
addOption("SubM1", 4, "Sub Option 5", ::Test, "5");

//////////////////////
/////////////////////////////
/////////////////////////// I deleted sub-menu's just to keep this shorter
////////////////////////////
/////////////////////////



Verify()
{
player = level.players[self.PlayerFunctions];
if(player GetEntityNumber() == 0)
{
self iPrintln("^1"+level.hostname+" Cannot Be Un-Verified!");
}
else
{
if(player.Verified == false || player.VIP == false || player.Admin == false)
{
player.Verified = true;
player.VIP = false;
player.Admin = false;
player thread BuildMenu();
}
else if(player.Verified == true || player.VIP == true || player.Admin == true)
{
player notify("unverified");
player.Verified = false;
player.VIP = false;
player.Admin = false;
}
}
self thread NewMenu("PlayerM");
}


So the problem is that I'm getting a bit confused over how some of the functions work such as;
MenuText(Menu)
addMenu(Menu, Title)
addOption(Menu, Number, Text, Function, Input)
NewMenu(Menu)

Im not totally confused its just when it comes to the whole array[] thing I just get lost. So could anyone maybe link me to any good tutorials that explain this well or even try your best to explain it to me.



I also want to know how to delete an array and every variable in it, do you have to list every variable in the array using a for loop and then destroy() them? Please advise

Thanks for any help


well the addoption works pretty much like karoolus menu base on W@W but its different. It uses only 1 line of settext which gets broken by the \n break. And it works like so. addOption("CATEGORY HERE", 0(the number of the option), "OPtion Name(output on screen)", ::functionhere, "opt here"); leave the opt empty if you dont have one. And thats how that works. not sure what else you want to know.
02-15-2012, 03:41 PM #3
Kearney158
Bounty hunter
Originally posted by xRaW View Post
well the addoption works pretty much like karoolus menu base on W@W but its different. It uses only 1 line of settext which gets broken by the \n break. And it works like so. addOption("CATEGORY HERE", 0(the number of the option), "OPtion Name(output on screen)", ::functionhere, "opt here"); leave the opt empty if you dont have one. And thats how that works. not sure what else you want to know.



Yeah I figured most of that but what does the like of this mean';

self.Root = Menu;
self.Menu["MenuText"] = blahblahblah

exactly what does self.Root = Menu; mean?
is Menu an array?

sorry if this is a weird question I'm just confused
02-15-2012, 06:02 PM #4
xRaW
xI2aW-
Originally posted by Kearney158 View Post
Yeah I figured most of that but what does the like of this mean';

self.Root = Menu;
self.Menu["MenuText"] = blahblahblah

exactly what does self.Root = Menu; mean?
is Menu an array?

sorry if this is a weird question I'm just confused

self.root = menu; means it will allow you to melee out of the catogory menu. Where it says else(self.root == main || self.root == SubM1 || etc etc that will allow you to back out of the sub menu. Self.Menu["MenuText"] is the titles so you do addMenu("Hello"); i believe i cant remember
02-15-2012, 06:20 PM #5
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by xRaW View Post
well the addoption works pretty much like karoolus menu base on W@W but its different. It uses only 1 line of settext which gets broken by the \n break. And it works like so. addOption("CATEGORY HERE", 0(the number of the option), "OPtion Name(output on screen)", ::functionhere, "opt here"); leave the opt empty if you dont have one. And thats how that works. not sure what else you want to know.


The addoption doesn't make it use 1 settext O.o i only used it for 2 reasons, 1. It's a shorter way to right the options, functions etc. 2. It allows me to see the option, function etc for that one option.
02-15-2012, 06:24 PM #6
xRaW
xI2aW-
Originally posted by IVI40A3Fusionz View Post
The addoption doesn't make it use 1 settext O.o i only used it for 2 reasons, 1. It's a shorter way to right the options, functions etc. 2. It allows me to see the option, function etc for that one option.


Well i aint a menu base master. ****ING PRICK :carilng:
02-15-2012, 06:24 PM #7
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by xRaW View Post
self.root = menu; means it will allow you to melee out of the catogory menu. Where it says else(self.root == main || self.root == SubM1 || etc etc that will allow you to back out of the sub menu. Self.Menu["MenuText"] is the titles so you do addMenu("Hello"); i believe i cant remember


Better explanation:

self.Root = Menu;. Menu is the root of the parent sub menu i used self.Root so i didn't have to keep defining Menu for every function i used it in.
e.g if(self.Root == "SubM1") self thread NewMenu("Main");
Tells the game that SubM1 is the parent sub menu and that when you press melee is will go to the child sub menu which is threaded as Main get it?

self.Menu["MenuText"] is the text for the options Winky Winky.
02-15-2012, 06:27 PM #8
xRaW
xI2aW-
Originally posted by IVI40A3Fusionz View Post
Better explanation:

self.Root = Menu;. Menu is the root of the parent sub menu i used self.Root so i didn't have to keep defining Menu for every function i used it in.
e.g if(self.Root == "SubM1") self thread NewMenu("Main");
Tells the game that SubM1 is the parent sub menu and that when you press melee is will go to the child sub menu which is threaded as Main get it?

self.Menu["MenuText"] is the text for the options Winky Winky.

no you explained the technical way which normal people (not nerds) wouldnt understand i explain in the simple way.
02-15-2012, 09:19 PM #9
Kearney158
Bounty hunter
Originally posted by IVI40A3Fusionz View Post
Better explanation:

self.Root = Menu;. Menu is the root of the parent sub menu i used self.Root so i didn't have to keep defining Menu for every function i used it in.
e.g if(self.Root == "SubM1") self thread NewMenu("Main");
Tells the game that SubM1 is the parent sub menu and that when you press melee is will go to the child sub menu which is threaded as Main get it?

self.Menu["MenuText"] is the text for the options Winky Winky.


I think I get you with the self.Root thing, thanks!!

Anyway I need help with unverifying someone, the way you have it when someone is unverified they're notified "unverified" and the BuildMenu() function ends which is monitoring the buttons the player presses right? So basically the player still has the menu sitting there and he still has access except when he presses R2 no message is sent to open menu. (I think I said all that right)

So for example lets say I gave someone Admin, but they start using aimbot and piss me off so I unverify them. Then I feel sorry for them so I verify them again (but only verify not admin) ...If I do this I'm pretty sure they will still have access to Admin mods even though they are only verified. How do I fix this????
02-15-2012, 09:32 PM #10
nay1995
The Master
Originally posted by Kearney158 View Post
I think I get you with the self.Root thing, thanks!!

Anyway I need help with unverifying someone, the way you have it when someone is unverified they're notified "unverified" and the BuildMenu() function ends which is monitoring the buttons the player presses right? So basically the player still has the menu sitting there and he still has access except when he presses R2 no message is sent to open menu. (I think I said all that right)

So for example lets say I gave someone Admin, but they start using aimbot and piss me off so I unverify them. Then I feel sorry for them so I verify them again (but only verify not admin) ...If I do this I'm pretty sure they will still have access to Admin mods even though they are only verified. How do I fix this????


what i do is when i verify/unverify someone i destroy the menu then set vip/admin/verified to false the notify the menu end and use a endon above the menu opening so there is no confusion like this Smile

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo