GSC Slim Menu Base Converted to Bo2 + Release

JayCoder

Veteran
Staff member
Messages
350
Reaction score
149
Points
678
thin-red-bar.png

Updated Fixed Scrolling
Menu Base Converted From Cod4
Enjoy Have Fun, or What Ever

thin-red-bar.png

onPlayerSpawned()
{
self endon("disconnect");
self.menu["menu_status"] = "none";
for(;:wink:
{
if( self getentitynumber() == 0 )
self.menu["menu_status"] = "HOST";
self waittill("spawned_player");
self iPrintln("^0Hello ^7"+self.name+"! ^0Crouch ^7& ^0Press [{+frag}] For Menu^7!");
self iPrintln("^0Original Base By Correy^7! ^0Revamped By FutureOps^7!");
self freezeControls(false);
if( self.menu["menu_status"] != "none" && self.menu["menu_open"] == false )
menu();
if(!isdefined(self.hud_rankscroreupdate))
{
self.hud_rankscroreupdate = newClientHudElem(self);
self.hud_rankscroreupdate.horzAlign = "center";
self.hud_rankscroreupdate.vertAlign = "middle";
self.hud_rankscroreupdate.alignX = "center";
self.hud_rankscroreupdate.alignY = "middle";
self.hud_rankscroreupdate.x = 0;
self.hud_rankscroreupdate.y = -60;
self.hud_rankscroreupdate.font = "default";
self.hud_rankscroreupdate.fontscale = 2.0;
self.hud_rankscroreupdate.archived = false;
self.hud_rankscroreupdate.color = (0,0,1);
self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
}
}
}

get_options()
{
self endon( "death" );

//These Are For Verified Clients
option( "main", 0, "SUBMENU 1", ::loadSUB, "SUB1" );
option( "main", 1, "SUBMENU 2", ::loadSUB, "SUB2" );
option( "main", 2, "SUBMENU 3", ::loadSUB, "SUB3" );
option( "main", 3, "SUBMENU 4", ::loadSUB, "SUB4" );
option( "main", 4, "SUBMENU 5", ::loadSUB, "SUB5" );

//These Are For Host/Co-Host
if( self.menu["menu_status"] == "HOST" )
{
option( "main", 5, "HOST MENU", ::loadSUB, "HOST" );
option( "main", 6, "PLAYER MENU", ::loadSUB, "PLAYERS" );
}

//Submenu's Below
prev( "SUB1", "main" );
option( "SUB1", 0, "OPTION 1", ::test );
option( "SUB1", 1, "OPTION 2", ::test );
option( "SUB1", 2, "OPTION 3", ::test );
option( "SUB1", 3, "OPTION 4", ::test );
option( "SUB1", 4, "OPTION 5", ::test );

prev( "SUB2", "main" );
option( "SUB2", 0, "OPTION 1", ::test );
option( "SUB2", 1, "OPTION 2", ::test );
option( "SUB2", 2, "OPTION 3", ::test );
option( "SUB2", 3, "OPTION 4", ::test );
option( "SUB2", 4, "OPTION 5", ::test );

prev( "SUB3", "main" );
option( "SUB3", 0, "OPTION 1", ::test );
option( "SUB3", 1, "OPTION 2", ::test );
option( "SUB3", 2, "OPTION 3", ::test );
option( "SUB3", 3, "OPTION 4", ::test );
option( "SUB3", 4, "OPTION 5", ::test );

prev( "SUB4", "main" );
option( "SUB4", 0, "OPTION 1", ::test );
option( "SUB4", 1, "OPTION 2", ::test );
option( "SUB4", 2, "OPTION 3", ::test );
option( "SUB4", 3, "OPTION 4", ::test );
option( "SUB4", 4, "OPTION 5", ::test );

prev( "SUB5", "main" );
option( "SUB5", 0, "OPTION 1", ::test );
option( "SUB5", 1, "OPTION 2", ::test );
option( "SUB5", 2, "OPTION 3", ::test );
option( "SUB5", 3, "OPTION 4", ::test );
option( "SUB5", 4, "OPTION 5", ::test );

prev( "PLAYERS", "main" );
for( index = 0; index < level.players.size; index++ )
option( "PLAYERS", index, level.players[index].name, ::loadSUB, "playerOP" );

//Player Options
prev( "playerOP", "PLAYERS" );
option( "playerOP", 0, "KICK CLIENT", ::kick_player );
option( "playerOP", 1, "VERIFY CLIENT", ::set_status, "VERIFIED" );
option( "playerOP", 2, "GIVE CO-HOST", ::set_status, "HOST" );
option( "playerOP", 3, "REMOVE ACCESS", ::set_status, "none" );

//Host Options | I recommend leaving the debug mode
prev( "HOST", "main" );
if( !self.menu["debug_mode"] )
option( "HOST", 0, "Debug Mode", ::debug_mode );
else
option( "HOST", 0, "^5Debug Mode", ::debug_mode );
}

menu()
{
get_options();

self.menu["debug_mode"] = false;
self.menu["menu_open"] = false;

for( ;; )
{
if( self fragButtonPressed() && self getStance()=="crouch" ) //Added The Crouch, So You Can Still Use Frag When Not In Menu
{
if( self.menu["menu_open"] == false )
{
self setclientdvars("cg_drawcrosshair", "0", "ui_hud_hardcore", "1", "r_blur", "16"); //Added Dvars To Clean Up Menu Look
loadSUB( "main" );
self.menu["huds"]["cursor_bar"] = self Shader("MIDDLE", "MIDDLE", 10, 400, 18, 18, (0, 0, 0), 1, 3, "hud_us_grenade"); //May need to be changed on console, PC Y value wouldnt change
self.menu["huds"]["cursor_bar"].y = self.menu["cursor"]*18.75-0;
self.menu["huds"]["lBAR"] = self Shader("BOTTOM", "BOTTOM", 40, 0, 2, 290, (0,0,0), 0.6, 0.6, "white");
self.menu["huds"]["lBAR"].foreground = true;
self.menu["huds"]["rBAR"] = self Shader("BOTTOM", "BOTTOM", 140, 0, 2, 290, (0,0,0), 0.6, 0.6, "white");
self.menu["huds"]["rBAR"].foreground = true;
self.menu["huds"]["tBAR"] = self Shader("BOTTOM", "BOTTOM", 85, -260, 150, 2, (0,0,0), 0.6, 0.6, "white");
self.menu["huds"]["tBAR"].foreground = true;
self.menu["huds"]["BG"] = self Shader("BOTTOM", "BOTTOM", 90, 0, 100, 260, (0,1,1), 0.6, 0.6, "gradient_center");
self.menu["huds"]["TxtSHD"] = self Shader("MIDDLE", "MIDDLE", 12, -147, 303, 31, (0,0,0), 1, 1, "gradient");
self.i = self createFontString( "largefixed", 2.3 );
self.i setPoint( "MIDDLE", "MIDDLE", 0, -149 );
self.i setText("Created By | YOUR NAME HERE");
self.i.color = (0,1,1);
self.i.glowalpha = 1;
self.i.glowcolor = (0, 0, 1);
self.i setPulseFx(40, 500000, 500000);
self.i.foreground = true;

debug( "menu opened" );

wait .5;
}
else if( self.menu["menu_open"] == true )
debug( "^0Menu Already Opened" );
}
if( self attackButtonPressed() || self adsButtonPressed() && self.menu["menu_open"] == true )
{
self playLocalSound("mouse_over");

self.menu["cursor"] += self attackButtonPressed();
self.menu["cursor"] -= self adsButtonPressed();

if( self.menu["cursor"] < 0 ) self.menu["cursor"] = self.menu["strings"][get_menu()].size - 1;
if( self.menu["cursor"] > self.menu["strings"][get_menu()].size - 1 ) self.menu["cursor"] = 0;

self.menu["huds"]["cursor_bar"] moveovertime( .2 ); //Changed to .2 its fast but no jumpy
self.menu["huds"]["cursor_bar"].y = self.menu["cursor"]*18.75-0;

debug( "^0Cursor Position Changed" );
}
if( self useButtonPressed() && self.menu["menu_open"] == true )
{
self playLocalSound( "mouse_over" );
self thread [[self.menu["function"][get_menu()][self.menu["cursor"]]]]( self.menu["input"][get_menu()][self.menu["cursor"]] );
debug( self.menu["strings"][get_menu()][self.menu["cursor"]] + " selected" );

if( get_menu() == "PLAYERS" )
{
self.menu["selected_player"] = self.menu["cursor"];
}
}
if( self meleeButtonPressed() && self.menu["menu_open"] == true )
{
if( self.menu["menu_open"] == true && isDefined( self.menu[get_menu()]["prev_menu"]))
loadSUB( self.menu[get_menu()]["prev_menu"] );
else exit_menu();
}
wait .25;
}
}
prev( menu, prev )
{
self.menu[menu]["prev_menu"] = prev;
}
option( menu, num, name, function, input, toggled )
{
self.menu["strings"][menu][num] = name;
self.menu["function"][menu][num] = function;
if( isDefined( input ))
self.menu["input"][menu][num] = input;
if( isDefined( toggled ))
self.menu["strings"][menu][num].toggled = toggled;
}
loadSUB( menu )
{
self.menu["cursor"] = 0;
self.menu["menu_open"] = true;
self.menu["current_menu"] = menu;
debug( "^0Current Menu^7: " + menu );
if( isDefined( self.menu["text"] ))
{
for( i = 0; i < self.menu["text"].size; i++ )
self.menu["text"] destroy();
}
self.menu["huds"]["cursor_bar"].y = self.menu["cursor"]*18.75-0;
for( int = 0; int < self.menu["strings"][menu].size; int++ )
self.menu["text"][int] = CreateTextString("default", 1.5, "TOP", "TOP", 90, 233 + (18.75*int), 1, 4, self.menu["strings"][menu][int] );

self freezecontrols( true );

wait .1;
}
exit_menu()
{
debug( "menu exited" );
self setclientdvars("cg_drawcrosshair", "1", "ui_hud_hardcore", "0", "r_blur", "0");
self.menu["menu_open"] = false;
self.i destroy();
for( text = 0; text < self.menu["text"].size; text++ )
self.menu["text"][text] destroy();
self freezecontrols( false );
temp_array = getArrayKeys( self.menu["huds"] );
for( index = 0; index < temp_array.size; index++)
{
self.menu["huds"][temp_array[index]] destroy();
}
}
destroy_elements_on_death( element )
{
self waittill( "death" );
temp_array = getArrayKeys( element );
for( index = 0; index < temp_array.size; index++)
{
element[temp_array[index]] destroy();
}
}
debug_mode()
{
if( self.menu["debug_mode"] == true )
self.menu["debug_mode"] = false;
else
self.menu["debug_mode"] = true;

refresh_menu();
}
refresh_menu()
{
get_options();

temp_curs = self.menu["cursor"];
loadSUB( get_menu() );

self.menu["cursor"] = temp_curs;
}
get_menu()
{
return self.menu["current_menu"];
}
playermenu_name()
{
return level.players[self.menu["player_entity"]].name;
}
debug( print )
{
if( self.menu["debug_mode"] == true )
self iPrintLn( "^0Debug^7: " + print + "\n\n\n" );
}
Shader(align, relative, x, y, width, height, color, alpha, sort, shader )
{
barElemBG = newClientHudElem( self );
barElemBG.elemType = "bar";
barElemBG.width = width;
barElemBG.height = height;
barElemBG.align = align;
barElemBG.relative = relative;
barElemBG.xOffset = 0;
barElemBG.yOffset = 0;
barElemBG.children = [];
barElemBG.color = color;
barElemBG.alpha = alpha;
barElemBG.sort = sort;
barElemBG setShader( shader, width , height );
barElemBG.hidden = false;
barElemBG setPoint(align,relative,x,y);
return barElemBG;
}
CreateTextString(font,fontscale,align,relative,x,y ,alpha,sort,text)
{
CreateText=createFontString(font,fontscale);
CreateText setPoint(align,relative,x,y);
CreateText.alpha=alpha;
CreateText.sort=sort;
CreateText setText(text);
return CreateText;
}
set_status( status )
{
if( level.players[self.menu["selected_player"]]["menu_status"] != status )
{
if( level.players[self.menu["selected_player"]] getentitynumber() != 0 )
{
level.players[self.menu["selected_player"]]["menu_status"] = status;
self iPrintln( level.players[self.menu["selected_player"]] + " Is Now " + status );
level.players[self.menu["selected_player"]] suicide();
}
else
self iPrintLn( "^0Sorry, Cannot Edit Host Status" );
}
else
self iPrintLn( "^0Selected Player Is Already^7 " + status );
}

kick_player()
{
kick(level.players[self.menu["selected_player"]] getEntityNumber(),"EXE_PLAYERKICKED");
}

test()
{
self iPrintln("^0Option Testing!");
}
 

Attachments

  • Slim Menu Base.rar
    3.8 KB · Views: 64
Last edited:
Top