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
02-15-2012, 09:43 PM #11
IVI40A3Fusionz
Former Gaming Squad Member
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????


If you unverify someone that is say Admin then verify them to just verified it should set the to have Verified as true, VIP and Admin as false meaning they shouldn't get access to options their verified level doesn't allow :/.
02-15-2012, 10:17 PM #12
Kearney158
Bounty hunter
Originally posted by IVI40A3Fusionz View Post
If you unverify someone that is say Admin then verify them to just verified it should set the to have Verified as true, VIP and Admin as false meaning they shouldn't get access to options their verified level doesn't allow :/.


Yeah the second time round they don't get access to the vip/admin mods in the iniMenu() function but that doesn't matter since they're all already defined from when I first gave him admin. In order for him(the player) to be just verified I would have to delete his previous self.MenuText variables before sending him through the buildMenu() function right?

Look if you don't believe me just try it yourself on the ps3

---------- Post added at 10:17 PM ---------- Previous post was at 10:07 PM ----------

Originally posted by nay View Post
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


This is what I tried doing but, me being a noob, I'm not very good at destroying things....I ended the iniMenu() and the BuildMenu() functions using endon(unverified) and I set ;

self.TitleText destroy();
self.MenuText destroy();
self.MenuFunction destroy();
self.MenuInput destroy();
self.Menu["Background"] destroy();
self.Menu["Scrollbar"] destroy();
self.Menu["MenuText"]destroy();
self.Menu["Title"]destroy();


yet when I re-verify them they still have admin mods! ....Im thinking I must have to destroy every variable from self.MenuText[] to completely unverify them, if that will solve my problem how do I do that??????

...im a bit lost here
02-15-2012, 10:25 PM #13
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by Kearney158 View Post
Yeah the second time round they don't get access to the vip/admin mods in the iniMenu() function but that doesn't matter since they're all already defined from when I first gave him admin. In order for him(the player) to be just verified I would have to delete his previous self.MenuText variables before sending him through the buildMenu() function right?

Look if you don't believe me just try it yourself on the ps3

---------- Post added at 10:17 PM ---------- Previous post was at 10:07 PM ----------



This is what I tried doing but, me being a noob, I'm not very good at destroying things....I ended the iniMenu() and the BuildMenu() functions using endon(unverified) and I set ;

self.TitleText destroy();
self.MenuText destroy();
self.MenuFunction destroy();
self.MenuInput destroy();
self.Menu["Background"] destroy();
self.Menu["Scrollbar"] destroy();
self.Menu["MenuText"]destroy();
self.Menu["Title"]destroy();


yet when I re-verify them they still have admin mods! ....Im thinking I must have to destroy every variable from self.MenuText[] to completely unverify them, if that will solve my problem how do I do that??????

...im a bit lost here


simply destroying the menu text won't prevent people that have been re-verified from admin getting the admin options.
Also i have tested my menu base on PS3 using bots and using split screen everything worked perfectly fine for me.
02-15-2012, 10:32 PM #14
Kearney158
Bounty hunter
Originally posted by IVI40A3Fusionz View Post
simply destroying the menu text won't prevent people that have been re-verified from admin getting the admin options.
Also i have tested my menu base on PS3 using bots and using split screen everything worked perfectly fine for me.


I guessed as much that it'd be more awkward than that....are you sure you tested it right because I just tried it....

1st give player admin, then unverify him, then give verified..... technically yes self.verified will be true while self.vip and self.admin will be false but the player will still be able to access the vip/admin mods

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo