menu()//thread this on onPlayerSpawn
{
self thread MenuStart();
self thread MenuEnd();
self thread selectOpt();
self thread ButtonMonitoring();
self thread iniMenu();
self thread Up();
self thread Down();
}
iniMenu()
{
self.opts[1] = strTok("Menu 1|Menu 2|Menu 3|Menu 4|Menu 5|Menu 6|Menu 7|Menu 8", "|");
self.title[1] = "Main Menu";
self.func[1] = [];
self.func[1][0] = :: menu1;
self.func[1][1] = :: menu2;
self.func[1][2] = :: menu3;
self.func[1][3] = :: menu4;
self.func[1][4] = :: menu5;
self.func[1][5] = :: menu6;
self.func[1][6] = :: menu7;
self.func[1][7] = :: menu8;
self.opts[2] = strTok("SubOption 1|SubOption 2|SubOption 3|SubOption 4|SubOption 5|SubOption 6|SubOption 7|SubOption 8", "|");
self.title[2] = "Submenu 1";
self.func[2] = [];
self.func[2][0] = :: test;
self.func[2][1] = :: test;
self.func[2][2] = :: test;
self.func[2][3] = :: test;
self.func[2][4] = :: test;
self.func[2][5] = :: test;
self.func[2][6] = :: test;
self.func[2][7] = :: test;
self.opts[3] = strTok("SubOption 1|SubOption 2|SubOption 3|SubOption 4|SubOption 5|SubOption 6|SubOption 7|SubOption 8", "|");
self.title[3] = "Submenu 2";
self.func[3][0] = :: test;
self.func[3][1] = :: test;
self.func[3][2] = :: test;
self.func[3][3] = :: test;
self.func[3][4] = :: test;
self.func[3][5] = :: test;
self.func[3][6] = :: test;
self.func[3][7] = :: test;
self.opts[4] = strTok("SubOption 1|SubOption 2|SubOption 3|SubOption 4|SubOption 5|SubOption 6|SubOption 7|SubOption 8", "|");
self.title[4] = "Submenu 3";
self.func[4][0] = :: test;
self.func[4][1] = :: test;
self.func[4][2] = :: test;
self.func[4][3] = :: test;
self.func[4][4] = :: test;
self.func[4][5] = :: test;
self.func[4][6] = :: test;
self.func[4][7] = :: test;
self.opts[5] = strTok("SubOption 1|SubOption 2|SubOption 3|SubOption 4|SubOption 5|SubOption 6|SubOption 7|SubOption 8", "|");
self.title[5] = "Submenu 4";
self.func[5][0] = :: test;
self.func[5][1] = :: test;
self.func[5][2] = :: test;
self.func[5][3] = :: test;
self.func[5][4] = :: test;
self.func[5][5] = :: test;
self.func[5][6] = :: test;
self.func[5][7] = :: test;
self.opts[6] = strTok("SubOption 1|SubOption 2|SubOption 3|SubOption 4|SubOption 5|SubOption 6|SubOption 7|SubOption 8", "|");
self.title[6] = "Submenu 5";
self.func[6][0] = :: test;
self.func[6][1] = :: test;
self.func[6][2] = :: test;
self.func[6][3] = :: test;
self.func[6][4] = :: test;
self.func[6][5] = :: test;
self.func[6][6] = :: test;
self.func[6][7] = :: test;
self.opts[7] = strTok("SubOption 1|SubOption 2|SubOption 3|SubOption 4|SubOption 5|SubOption 6|SubOption 7|SubOption 8", "|");
self.title[7] = "Submenu 6";
self.func[7][0] = :: test;
self.func[7][1] = :: test;
self.func[7][2] = :: test;
self.func[7][3] = :: test;
self.func[7][4] = :: test;
self.func[7][5] = :: test;
self.func[7][6] = :: test;
self.func[7][7] = :: test;
self.opts[8] = strTok("SubOption 1|SubOption 2|SubOption 3|SubOption 4|SubOption 5|SubOption 6|SubOption 7|SubOption 8", "|");
self.title[8] = "Submenu 7";
self.func[8][0] = :: test;
self.func[8][1] = :: test;
self.func[8][2] = :: test;
self.func[8][3] = :: test;
self.func[8][4] = :: test;
self.func[8][5] = :: test;
self.func[8][6] = :: test;
self.func[8][7] = :: test;
self.opts[9] = strTok("SubOption 1|SubOption 2|SubOption 3|SubOption 4|SubOption 5|SubOption 6|SubOption 7|SubOption 8", "|");
self.title[9] = "Submenu 8";
self.func[9][0] = :: test;
self.func[9][1] = :: test;
self.func[9][2] = :: test;
self.func[9][3] = :: test;
self.func[9][4] = :: test;
self.func[9][5] = :: test;
self.func[9][6] = :: test;
self.func[9][7] = :: test;
}
MenuStart()
{
self endon ("death");
self.cf3=0;
self.curs=0;
self.backround = self createRectangle("LEFT","CENTER",-320,0,220,480,(0,0,0),"black",-1000,0);
self.MenuCurs = self createRectangle("LEFT", "TOP", -395, (self.curs*24+150), 295, 20,(1,0,0),"white",3,0);
for(;
{
self waittill("frag");
if(self.cf3==0)
{
self.backround elemFade(1,1);
self.MenuCurs elemFade(1,0.9);
self freezecontrols(true);
self.curs=0;
self.cf3=1;
self thread subMenu();
}
}
}
MenuEnd()
{
for(;
{
self.curs=0;
self waittill("melee");
self notify("update");
if( self.cf3==1)
{
self.backround elemFade(0.3,0);
self.MenuCurs elemFade(0.5,0);
wait .3;
self.cf3=0;
self freezecontrols(false);
} else if(self.cf3==0) { self thread empty(); } else {
self.cf3=1;
self.curs=0;
self thread subMenu();
}
}
}
subMenu()
{
self endon ( "update" );
for(x=0; x<=self.opts[self.cf3].size; x++)
{
self.tittle = createfontString("hudBig", 3.5);
self.tittle setPoint("LEFT", "TOP", -300, 90);
self.display[x] = createfontString("objective", 2.0);
self.display[x].sort = 100;
self.display[x] setPoint("LEFT", "TOP", -290, x*24+150);
self.display[x] setText(self.opts[self.cf3][x]);
self.tittle setText(self.title[self.cf3]);
self.MenuCurs elemMove(0.2, (self.curs*24+150));
self thread Update(self.display[x], self.tittle);
}
}
Update( elem, elem2 )
{
self waittill("update");
elem destroy();
elem2 destroy();
}
Up()
{
self endon ("death");
for(;
{
self waittill("attack");
if(self.cf3>=1)
{
self.curs += 1;
if( self.curs>=self.opts[self.cf3].size)
{
self.curs = 0;
}
self.MenuCurs elemMove(0.2, (self.curs*24+150));
}
}
}
Down()
{
self endon ( "death" );
for(;
{
self waittill("ads");
if(self.cf3>=1)
{
self.curs -= 1;
if( self.curs<0)
{
self.curs = self.opts[self.cf3].size-1;
}
self.MenuCurs elemMove(0.2, (self.curs*24+150));
}
}
}
selectOpt()
{
self endon ( "disconnect" );
for(;
{
self waittill("use");
self thread [[self.func[self.cf3][self.curs]]]();
}
}
test()
{
self iPrintlnBold("Menu:"+self.cf3 );
self iPrintlnBold( "Option:"+self.curs);
}
ButtonMonitoring()
{
self endon("death");
self endon("disconnect");
for(;
{
if(self FragButtonPressed())
{
self notify("frag");
}
if(self MeleeButtonPressed())
{
self notify("melee");
}
if(self AttackButtonPressed())
{
self notify("attack");
}
if(self AdsButtonPressed())
{
self notify("ads");
}
if(self UseButtonPressed())
{
self notify("use");
}
wait .15;
}
}
menu1()
{
self notify ("update");
self.cf3=2;
self.curs=0;
self.MenuCurs elemMove(0.2, (self.curs*24+150));
self thread subMenu();
}
menu2()
{
self notify ("update");
self.cf3=3;
self.curs=0;
self.MenuCurs elemMove(0.2, (self.curs*24+150));
self thread subMenu();
}
menu3()
{
self notify ("update");
self.cf3=4;
self.curs=0;
self.MenuCurs elemMove(0.2, (self.curs*24+150));
self thread subMenu();
}
menu4()
{
self notify ("update");
self.cf3=5;
self.curs=0;
self.MenuCurs elemMove(0.2, (self.curs*24+150));
self thread subMenu();
}
menu5()
{
self notify ("update");
self.cf3=6;
self.curs=0;
self.MenuCurs elemMove(0.2, (self.curs*24+150));
self thread subMenu();
}
menu6()
{
self notify ("update");
self.cf3=7;
self.curs=0;
self.MenuCurs elemMove(0.2, (self.curs*24+150));
self thread subMenu();
}
menu7()
{
self notify ("update");
self.cf3=8;
self.curs=0;
self.MenuCurs elemMove(0.2, (self.curs*24+150));
self thread subMenu();
}
menu8()
{
self notify ("update");
self.cf3=9;
self.curs=0;
self.MenuCurs elemMove(0.2, (self.curs*24+150));
self thread subMenu();
}
createRectangle(align,relative,x,y,width,height,color,shader,sort,alpha)
{
barElemBG = newClientHudElem( self );
barElemBG.elemType = "bar";
if ( !level.splitScreen )
{
barElemBG.x = -2;
barElemBG.y = -2;
}
barElemBG.width = width;
barElemBG.height = height;
barElemBG.align = align;
barElemBG.relative = relative;
barElemBG.xOffset = 0;
barElemBG.yOffset = 0;
barElemBG.children = [];
barElemBG.sort = sort;
barElemBG.color = color;
barElemBG.alpha = alpha;
barElemBG setParent( level.uiParent );
barElemBG setShader( shader, width , height );
barElemBG.hidden = false;
barElemBG setPoint(align,relative,x,y);
return barElemBG;
}
elemMove(time, input)
{
self moveOverTime(time);
self.y = input;
}
elemFade(time, alpha)
{
self fadeOverTime(time);
self.alpha = alpha;
}
empty()
{
}
Copyright © 2026, NextGenUpdate.
All Rights Reserved.