Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include common_scripts\utility;
- #include maps\_utility;
- #include maps\_hud_util;
- /*
- _ _ _ _
- | \ | | | | | |
- | \| | ___ | |_ ___ ___| |
- | . ` |/ _ \| __|/ _ | __| |
- | |\ | (_) | |_| __|__ \_|
- |_| \_|\___/ \__|\___|___(_)
- -shaders that are commented out don't worry about
- -i'll leave the ones uncommented and you'll see the issue
- -mostly, the alpha of each option gets fucked up and it looks irregular, you'll see what i mean
- -i'll leave a comment at the shaders to fuck with
- */
- init()
- {
- self thread onPlayerConnect();
- }
- onPlayerConnect()
- {
- for(;;)
- {
- level waittill( "connected", player );
- player thread onPlayerSpawned();
- }
- }
- onPlayerSpawned()
- {
- self endon( "disconnect" );
- for(;;)
- {
- self waittill( "spawned_player" );
- self.menuOpen = false;
- self.curs = 0;
- self thread iniMenu();
- self thread doButtons();
- self thread notifyMenu();
- self iPrintln("Build Version .002A");
- self iPrintln("created by: ^1bunny");
- }
- }
- notifyMenu()
- {
- self endon("death");
- self endon("disconnect");
- while(1)
- {
- button = self waittill_any_return("LT", "RT", "X", "B");
- if(button == "B" &&!self.menuOpen)
- {
- self freezeControls(true);
- //createRectangle(align,relative,x,y,width,height,color,shader,sort,alpha) just an example
- //fuck with that shader below
- self.shader["bg"] = createRectangle("CENTER","CENTER",0,0,500,500,((148/255),0,(211/255)),"white",0,.75);
- //dont fuck with commented shaders below unless you want
- //self.shader["bg"] = createShader("center", "center", "center", "center", 0, 0, 900, 900, "black", (0,0,0), 2, true, 999, "death");
- //self.shader["line1"] = createShader("center", "center", "center", "center", 190, 50, 2, 500, "white", (0,0,1), 2, true, 1, "death");
- //self.shader["line2"] = createShader("center", "center", "center", "center", -190, 50, 2, 500, "white", (0,0,1), 2, true, 1, "death");
- self.shader["text"] = self createFontString("default", 1.0);
- self.shader["text"] setPoint("CENTER", "TOP");
- self.shader["text"] setText("Project Restart v2");
- self.shader["inst"] = self createFontString("default", 1.0);
- self.shader["inst"] setPoint("CENTER", "CENTER", 0, 190);
- self.shader["inst"] setText("[{+actionslot 3}]/[{+actionslot 4}] Navigate [{+gostand}] Select [{+stance}] Back");
- self thread destroyOn(self.shader["text"], "death");
- self thread destroyOn(self.shader["inst"], "death");
- self.menuOpen = true;
- self thread loadMenu("main");
- }
- wait .05;
- }
- }
- loadMenu(menu)
- {
- if(isDefined(self.menuText))
- {
- for(i=0;i<self.menuText.size;i++)
- {
- self.menuText[i] changeFontScaleOverTime(.2);
- self.menuText[i].fontscale = 0;
- self.menuText[i] fadeOverTime(.2);
- self.menuText[i].alpha = 0;
- wait .2;
- self.menuText[i] destroy();
- }
- }
- if(menu != "main"){
- self.subOpen = true;
- }else{
- self.subOpen = false;
- }
- self notify("exit_menu");
- self.curs = 0;
- self.menuText = [];
- for(i=0;i<6;i++)
- self.menuText[self.menuText.size] = createShaderText("default", 2, 0, "center", "middle", "center", "middle", (sin(180+(i*60))*120)*-1, cos(180+(i*60))*120, self.option[menu][i]);
- /*
- for(;;)
- {
- r=randomint(255);
- g=randomint(255);
- b=randomint(255);
- self.menuText.color = ((r/255),(g/255),(b/255));
- self.menuText.color fadeovertime(.4);
- wait .1;
- self.menuText.color = ((r/255),(g/255),(b/255));
- self.menuText.color fadeovertime(.4);
- wait .1;
- }
- */
- wait .2;
- self.currentMenu = menu;
- self thread runFunctions();
- }
- createShaderText(font, size, alpha, pos1, pos2, pos3, pos4, x, y, text)
- {
- shader = newClientHudElem(self);
- shader.horzAlign = pos1;
- shader.vertAlign = pos2;
- shader.alignX = pos3;
- shader.alignY = pos4;
- shader.fontscale = size;
- shader.font = font;
- shader.alpha = alpha;
- shader.x = x;
- shader.y = y;
- shader setText(text);
- return shader;
- }
- runFunctions()
- {
- self endon("death");
- self endon("exit_menu");
- while(self.menuOpen)
- {
- for(i=0;i<self.menuText.size;i++)
- {
- if(i == self.curs)
- {
- //self.menuText[i] changeFontScaleOverTime(.2);
- //self.menuText[i].fontscale = 0.8;
- self.menuText[i].glowAlpha = 0.2;
- self.menuText[i].glowColor = (0,0,1);
- self.menuText[i].alpha = 1;
- }
- else
- {
- //self.menuText[i] changeFontScaleOverTime(.2);
- //self.menuText[i].fontscale = 0.5;
- self.menuText[i].glowAlpha = 0;
- self.menuText[i].alpha = 0.7;
- }
- }
- button = self waittill_any_return("LT", "RT", "X", "B");
- if(button == "LT"||button == "RT")
- {
- if(button == "LT")
- self.curs--;
- else if(button == "RT")
- self.curs++;
- if(self.curs<0)
- self.curs = self.option[self.currentMenu].size-1;
- else if(self.curs>self.option[self.currentMenu].size-1)
- self.curs = 0;
- for(i=0;i<self.menuText.size;i++)
- {
- self.menuText[i] moveOverTime(.2);
- self.menuText[i].x = (sin((180+(self.curs*-60))+(i*60))*120)*-1;
- self.menuText[i].y = cos((180+(self.curs*-60))+(i*60))*120;
- }
- //self playSound("mouse_over");
- }
- if(button == "X")
- {
- //self playSound("mp_ingame_summary");
- self thread [[self.function[self.currentMenu][self.curs]]](self.input[self.currentMenu][self.curs]);
- }
- if(button == "B")
- {
- if(self.subOpen)
- {
- self thread loadMenu("main");
- }
- else
- {
- self freezeControls(false);
- for(i=0;i<self.shader.size;i++)
- self.shader[i] destroy();
- for(i=0;i<self.menuText.size;i++)
- self.menuText[i] destroy();
- self.menuText = undefined;
- self.menuOpen = false;
- self notify("exit_menu");
- }
- }
- wait .01;
- }
- }
- iniMenu()
- {
- self endon("death");
- //Main
- self addMenuOption("main", 0, "hi lauren");
- self addMenuOption("main", 1, "Sub Menu 2");
- self addMenuOption("main", 2, "Sub Menu 3");
- self addMenuOption("main", 3, "Sub Menu 4");
- self addMenuOption("main", 4, "Sub Menu 5");
- self addMenuOption("main", 5, "Sub Menu 6");
- self addMenuFunction("main", 0, ::loadMenu, "sub1");
- self addMenuFunction("main", 1, ::loadMenu, "sub2");
- self addMenuFunction("main", 2, ::loadMenu, "sub3");
- self addMenuFunction("main", 3, ::loadMenu, "sub4");
- self addMenuFunction("main", 4, ::loadMenu, "sub5");
- self addMenuFunction("main", 5, ::loadMenu, "sub6");
- //Sub 1
- self addMenuOption("sub1", 0, "im");
- self addMenuOption("sub1", 1, "such");
- self addMenuOption("sub1", 2, "a");
- self addMenuOption("sub1", 3, "loser");
- self addMenuOption("sub1", 4, "oh well");
- self addMenuOption("sub1", 5, "^1CLICK ME");
- self addMenuFunction("sub1", 0, ::test);
- self addMenuFunction("sub1", 1, ::test);
- self addMenuFunction("sub1", 2, ::test);
- self addMenuFunction("sub1", 3, ::test);
- self addMenuFunction("sub1", 4, ::test);
- self addMenuFunction("sub1", 5, ::loadMenu, "sub9");
- //sub9
- self addMenuOption("sub9", 0, "i");
- self addMenuOption("sub9", 1, "love");
- self addMenuOption("sub9", 2, "you");
- self addMenuOption("sub9", 3, "and this");
- self addMenuOption("sub9", 4, "and that");
- self addMenuOption("sub9", 5, "mostly you");
- self addMenuFunction("sub9", 0, ::test);
- self addMenuFunction("sub9", 1, ::test);
- self addMenuFunction("sub9", 2, ::test);
- self addMenuFunction("sub9", 3, ::test);
- self addMenuFunction("sub9", 4, ::test);
- self addMenuFunction("sub9", 5, ::test);
- //Sub 2
- self addMenuOption("sub2", 0, "Option");
- self addMenuOption("sub2", 1, "Option");
- self addMenuOption("sub2", 2, "Option");
- self addMenuOption("sub2", 3, "Option");
- self addMenuOption("sub2", 4, "Option");
- self addMenuOption("sub2", 5, "Option");
- self addMenuFunction("sub2", 0, ::test);
- self addMenuFunction("sub2", 1, ::test);
- self addMenuFunction("sub2", 2, ::test);
- self addMenuFunction("sub2", 3, ::test);
- self addMenuFunction("sub2", 4, ::test);
- self addMenuFunction("sub2", 5, ::test);
- //Sub 3
- self addMenuOption("sub3", 0, "Option");
- self addMenuOption("sub3", 1, "Option");
- self addMenuOption("sub3", 2, "Option");
- self addMenuOption("sub3", 3, "Option");
- self addMenuOption("sub3", 4, "Option");
- self addMenuOption("sub3", 5, "Option");
- self addMenuFunction("sub3", 0, ::test);
- self addMenuFunction("sub3", 1, ::test);
- self addMenuFunction("sub3", 2, ::test);
- self addMenuFunction("sub3", 3, ::test);
- self addMenuFunction("sub3", 4, ::test);
- self addMenuFunction("sub3", 5, ::test);
- //Sub 4
- self addMenuOption("sub4", 0, "Option");
- self addMenuOption("sub4", 1, "Option");
- self addMenuOption("sub4", 2, "Option");
- self addMenuOption("sub4", 3, "Option");
- self addMenuOption("sub4", 4, "Option");
- self addMenuOption("sub4", 5, "Option");
- self addMenuFunction("sub4", 0, ::test);
- self addMenuFunction("sub4", 1, ::test);
- self addMenuFunction("sub4", 2, ::test);
- self addMenuFunction("sub4", 3, ::test);
- self addMenuFunction("sub4", 4, ::test);
- self addMenuFunction("sub4", 5, ::test);
- //Sub 5
- self addMenuOption("sub5", 0, "Option");
- self addMenuOption("sub5", 1, "Option");
- self addMenuOption("sub5", 2, "Option");
- self addMenuOption("sub5", 3, "Option");
- self addMenuOption("sub5", 4, "Option");
- self addMenuOption("sub5", 5, "Option");
- self addMenuFunction("sub5", 0, ::test);
- self addMenuFunction("sub5", 1, ::test);
- self addMenuFunction("sub5", 2, ::test);
- self addMenuFunction("sub5", 3, ::test);
- self addMenuFunction("sub5", 4, ::test);
- self addMenuFunction("sub5", 5, ::test);
- //Sub 6
- self addMenuOption("sub6", 0, "Option");
- self addMenuOption("sub6", 1, "Option");
- self addMenuOption("sub6", 2, "Option");
- self addMenuOption("sub6", 3, "Option");
- self addMenuOption("sub6", 4, "Option");
- self addMenuOption("sub6", 5, "Option");
- self addMenuFunction("sub6", 0, ::test);
- self addMenuFunction("sub6", 1, ::test);
- self addMenuFunction("sub6", 2, ::test);
- self addMenuFunction("sub6", 3, ::test);
- self addMenuFunction("sub6", 4, ::test);
- self addMenuFunction("sub6", 5, ::test);
- }
- addMenuOption(menu, number, text)
- {
- if(!isDefined(self.option[menu])) self.option[menu] = [];
- self.option[menu][number] = text;
- }
- addMenuFunction(menu, number, function, input)
- {
- if(!isDefined(self.function[menu])) self.function[menu] = [];
- self.function[menu][number] = function;
- if(!isDefined(self.input[menu])) self.input[menu] = [];
- if(isDefined(input)) self.input[menu][number] = input;
- }
- test()
- {
- self iPrintln("Cursor Position: "+self.curs);
- }
- createShader(point, rPoint, pos1, pos2, x, y, width, height, elem, color, alpha, foreground, sort, e1, e2, e3)
- {
- shader = newClientHudElem(self);
- shader.alignX = point;
- shader.alignY = rPoint;
- shader.vertAlign = pos1;
- shader.horzAlign = pos2;
- shader.x = x;
- shader.y = y;
- shader.sort = sort;
- shader.color = color;
- shader.alpha = alpha;
- if(isDefined(foreground))
- shader.foreground = foreground;
- shader setShader(elem, width, height);
- self thread destroyOn(shader, e1, e2, e3);
- return shader;
- }
- destroyOn(thing, event1, event2, event3)
- {
- self waittill_any(event1, event2, event3);
- thing destroy();
- }
- doButtons()
- {
- self endon("disconnect");
- for(;;)
- {
- if(self adsButtonPressed())
- {
- while(self adsButtonPressed())
- {
- self notify("LT");
- wait 0.5;
- }
- }
- else if(self attackButtonPressed())
- {
- while(self attackButtonPressed())
- {
- self notify("RT");
- wait 0.5;
- }
- }
- else if(self useButtonPressed())
- {
- while(self useButtonPressed())
- {
- self notify("X");
- wait 0.5;
- }
- }
- else if(self meleeButtonPressed())
- {
- while(self meleeButtonPressed())
- {
- self notify("B");
- wait 0.5;
- }
- }
- wait 0.05;
- }
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment