Black Ops 2 Mikeeeyy`s COD 4 Menu Base Ported To Black Ops 2 By Rezhified And Extinct

Rezhified

Veteran
Messages
69
Reaction score
43
Points
803
Code:
/*
*    Black Ops 2 - GSC Studio by iMCSx
*
*    Creator : Rezhified/Extinct
*    Project : menu base port
*    Mode : Multiplayer
*    Date : 2016/12/05 - 20:04:55
*
*/
 
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;
#include maps\mp\gametypes\_hud_message;
 
init()
{
    level thread onPlayerConnect();
}
 
onPlayerConnect()
{
    for(;;)
    {
        level waittill("connected", player);
        player thread onPlayerSpawned();
    }
}
 
onPlayerSpawned()
{
    self endon("disconnect");
    self.status = "Client";
    if(self == level.players[0])
        self.status = "Admin";
    for(;;)
    {
        self waittill("spawned_player");
        self.inMenu = undefined;
        self thread initMenu();
    }
}
 
initMenuOpts()
{
    m = "main";
    self addMenu(m, "Main Menu", undefined);
    self addOpt(m, "Sub Menu 1", ::subMenu, "Sub Menu 1");
    self addOpt(m, "Sub Menu 2", ::subMenu, "Sub Menu 2");
    self addOpt(m, "Sub Menu 3", ::subMenu, "Sub Menu 3");
    self addOpt(m, "Sub Menu 4", ::subMenu, "Sub Menu 4");
    self addOpt(m, "Sub Menu 5", ::subMenu, "Sub Menu 5");
    self addOpt(m, "Sub Menu 6", ::subMenu, "Sub Menu 6");
    self addOpt(m, "Sub Menu 7", ::subMenu, "Sub Menu 7");
    self addOpt(m, "Sub Menu 8", ::subMenu, "Sub Menu 8");
    self addOpt(m, "Sub Menu 9", ::subMenu, "Sub Menu 9");
    self addOpt(m, "Verification Menu", ::subMenu, "Verification");
 
    m = "Sub Menu 1";
    self addMenu(m, "Sub Menu 1", "main");
    self addOpt(m, "God Mode", ::godMode);
    self addOpt(m, "Test Option 1", ::test);
    self addOpt(m, "Test Option 2", ::test);
    self addOpt(m, "Test Option 3", ::test);
    self addOpt(m, "Test Option 4", ::test);
    self addOpt(m, "Test Option 5", ::test);
    self addOpt(m, "Test Option 6", ::test);
    self addOpt(m, "Test Option 7", ::test);
    self addOpt(m, "Test Option 8", ::test);
 
    m = "Sub Menu 2";
    self addMenu(m, "Sub Menu 2", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 3";
    self addMenu(m, "Sub Menu 3", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 4";
    self addMenu(m, "Sub Menu 4", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 5";
    self addMenu(m, "Sub Menu 5", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 6";
    self addMenu(m, "Sub Menu 6", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 7";
    self addMenu(m, "Sub Menu 7", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 8";
    self addMenu(m, "Sub Menu 8", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 9";
    self addMenu(m, "Sub Menu 9", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Verification";
    self addMenu(m, "Verification Menu", "main");
    for(e = 0; e < level.players.size; e++)
    {
        guy = level.players[e];
        name = guy.name;
        menu = "veri_"+name;
 
        if(e == 0 && self != level.players[0])
            continue;
        self addOpt(m, level.players[e].name, ::subMenu, menu);
 
        self addMenu(menu, name+"'s Options:", "veri");
        self addOpt(menu, "Set To: Client", ::setStatus, guy, "Client");
        self addOpt(menu, "Set To: Vip", ::setStatus, guy, "Vip");
        self addOpt(menu, "Set To: Admin", ::setStatus, guy, "Admin");
    }
}
 
initMenu()
{
    self endon("death");
    self endon("disconnect");
    self.openBox = self createRectangle("TOP", "TOP", 0, 2, 300, 30, (0, 0, 0), "white", 1, .7);
    self.openText = self createText("default", 1.5, "TOP", "TOP", 0, 8, 2, 1, (1, 0, 0), "Press [{+smoke}] To Open Menu");
    self.currentMenu = "main";
    self.menuCurs = 0;
    for(;;)
    {
        if(self secondaryOffHandButtonPressed())
        {
            if(!isDefined(self.inMenu))
            {
                self.inMenu = true;
                self thread deleteOffHand();
                self.openText.glowColor = (0, 1, 0);
                self.openText thread changeFontScaleOverTime(.4, 2);
                self.openText moveOverTime(.4);
                self.openText.y+= 5;
                self initMenuOpts();
                menuOpts = self.menuAction[self.currentMenu].opt.size;
                self.openBox scaleOverTime(.4, 300, ((menuOpts*19)+45));
                wait .4;
                self.openText setText(self.menuAction[self.currentMenu].title);
                string = "";
                for(m = 0; m < menuOpts; m++)
                    string+= self.menuAction[self.currentMenu].opt[m]+"\n";
                self.menuText = self createText("default", 1.5, "LEFT", "TOP", -130, 50, 3, 1, undefined, string);
                self.scrollBar = self createRectangle("TOP", "TOP", 0, ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2))), 300, 15, (0, 255, 0), "white", 2, .7);
            }
        }
        if(isDefined(self.inMenu))
        {
            if(self attackButtonPressed())
            {
                self.menuCurs++;
                if(self.menuCurs > self.menuAction[self.currentMenu].opt.size-1)
                    self.menuCurs = 0;
                self.scrollBar moveOverTime(.15);
                self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
                wait .15;
            }
            if(self adsButtonPressed())
            {
                self.menuCurs--;
                if(self.menuCurs < 0)
                    self.menuCurs = self.menuAction[self.currentMenu].opt.size-1;
                self.scrollBar moveOverTime(.15);
                self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
                wait .15;
            }
            if(self useButtonPressed())
            {
                self thread [[self.menuAction[self.currentMenu].func[self.menuCurs]]](self.menuAction[self.currentMenu].inp[self.menuCurs]);
                wait .2;
            }
            if(self meleeButtonPressed())
            {
                if(!isDefined(self.menuAction[self.currentMenu].parent))
                {
                    self.inMenu = undefined;
                    self.menuCurs = 0;
                    self.openText.glowColor = (0, 1, 0);
                    self.openText thread changeFontScaleOverTime(.4, 1.5);
                    self.openText moveOverTime(.4);
                    self.openText.y-= 5;
                    self.openBox scaleOverTime(.4, 300, 30);
                    self.menuText destroy();
                    self.scrollBar destroy();
                    wait .4;
                    self.openText.glowColor = (1, 0, 0);
                    self.openText setText("Press [{+smoke}] To Open Menu");
                }
                else
                    self subMenu(self.menuAction[self.currentMenu].parent);
            }
        }
        wait .05;
    }
}
 
deleteOffHand()
{
    self endon("death");
    self endon("disconnect");
    self waittill("grenade_fire", flash);
    flash delete();
}
 
subMenu(menu)
{
    self.menuCurs = 0;
    self.currentMenu = menu;
    self.scrollBar moveOverTime(.2);
    self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
    self.menuText destroy();
    self initMenuOpts();
    self.openText setText(self.menuAction[self.currentMenu].title);
    menuOpts = self.menuAction[self.currentMenu].opt.size;
    self.openBox scaleOverTime(.2, 300, ((menuOpts*19)+45));
    wait .2;
    string = "";
    for(m = 0; m < menuOpts; m++)
        string+= self.menuAction[self.currentMenu].opt[m]+"\n";
    self.menuText = self createText("default", 1.5, "LEFT", "TOP", -130, 50, 3, 1, undefined, string);
    wait .2;
}
 
test(inp)
{
    self iPrintln("Menu Base by ^2mikeeeeyy");
    self iPrintln("Ported from cod 4 to bo2");
    self iPrintln("By ^5Extinct ^7and ^6Rezhified");
}
 
godMode()
{
    if(!isDefined(self.godMode))
    {
        self.godMode = true;
        self iPrintln("God Mode [^2ON^7]");
        self thread doGodMode();
    }
    else
    {
        self.godMode = undefined;
        self iPrintln("God Mode [^1OFF^7]");
        self.health = 100;
        self.maxhealth = 100;
        self notify("godMode_over");
    }
}
 
doGodMode()
{
    self endon("death");
    self endon("disconnect");
    self endon("godMode_over");
    for(;;)
    {
        self.health = 999999;
        self.maxhealth = 999999;
        wait .05;
    }
}
 
setStatus(guy, status)
{
    guy.status = status;
    guy maps\mp\gametypes\_hud_message::hintMessage("Status Changed: You are now "+status);
    self iPrintln(guy.name+" Is Now "+status);
    guy suicide();
}
 
addMenu(menu, title, parent)
{
    if(!isDefined(self.menuAction))
        self.menuAction = [];
    self.menuAction[menu] = spawnStruct();
    self.menuAction[menu].title = title;
    self.menuAction[menu].parent = parent;
    self.menuAction[menu].opt = [];
    self.menuAction[menu].func = [];
    self.menuAction[menu].inp = [];
}
 
addOpt(menu, opt, func, inp, inp1)
{
    m = self.menuAction[menu].opt.size;
    self.menuAction[menu].opt[m] = opt;
    self.menuAction[menu].func[m] = func;
    self.menuAction[menu].inp[m] = inp;
    self.menuAction[menu].inp1[m] = inp1;
}
 
changeFontScaleOverTime(time, scale)
{
    start = self.fontscale;
    frames = (time / .05);
    scaleChange = (scale-start);
    scaleChangePer = (scaleChange/frames);
    for(m = 0; m < frames; m++)
    {
        self.fontscale+= scaleChangePer;
        wait .05;
    }
}
 
createText(font, fontScale, align, relative, x, y, sort, alpha, glow, text)
{
    textElem = self createFontString(font, fontScale);
    textElem setPoint(align, relative, x, y);
    textElem.sort = sort;
    textElem.alpha = alpha;
    textElem.glowColor = glow;
    textElem.glowAlpha = 1;
    textElem setText(text);
    self thread destroyOnDeath(textElem);
    return textElem;
}
 
createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha)
{
    boxElem = newClientHudElem(self);
    boxElem.elemType = "bar";
    if(!level.splitScreen)
    {
        boxElem.x = -2;
        boxElem.y = -2;
    }
    boxElem.width = width;
    boxElem.height = height;
    boxElem.align = align;
    boxElem.relative = relative;
    boxElem.xOffset = 0;
    boxElem.yOffset = 0;
    boxElem.children = [];
    boxElem.sort = sort;
    boxElem.color = color;
    boxElem.alpha = alpha;
    boxElem setParent(level.uiParent);
    boxElem setShader(shader, width, height);
    boxElem.hidden = false;
    boxElem setPoint(align, relative, x, y);
    self thread destroyOnDeath(boxElem);
    return boxElem;
}
 
destroyOnDeath(elem)
{
    self waittill_any("death", "disconnect");
    if(isDefined(elem.bar))
        elem destroyElem();
    else
        elem destroy();
    if(isDefined(elem.model))
        elem delete();
}

Video Link:

Credits:
Rezhified
Extinct
Mikeeeyy
 
Last edited:

DF_AUS

Moderator
Staff member
Head Staff Team
Donator
Messages
577
Reaction score
793
Points
878
Hey Rezhified,welcome to CCM,great release,for future references could you please add a small credits list to you're threads,i have added one for you this time being you're first post :wink:
 
S

SeriousHD-

Guest
Code:
/*
*    Black Ops 2 - GSC Studio by iMCSx
*
*    Creator : Rezhified/Extinct
*    Project : menu base port
*    Mode : Multiplayer
*    Date : 2016/12/05 - 20:04:55
*
*/
 
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;
#include maps\mp\gametypes\_hud_message;
 
init()
{
    level thread onPlayerConnect();
}
 
onPlayerConnect()
{
    for(;;)
    {
        level waittill("connected", player);
        player thread onPlayerSpawned();
    }
}
 
onPlayerSpawned()
{
    self endon("disconnect");
    self.status = "Client";
    if(self == level.players[0])
        self.status = "Admin";
    for(;;)
    {
        self waittill("spawned_player");
        self.inMenu = undefined;
        self thread initMenu();
    }
}
 
initMenuOpts()
{
    m = "main";
    self addMenu(m, "Main Menu", undefined);
    self addOpt(m, "Sub Menu 1", ::subMenu, "Sub Menu 1");
    self addOpt(m, "Sub Menu 2", ::subMenu, "Sub Menu 2");
    self addOpt(m, "Sub Menu 3", ::subMenu, "Sub Menu 3");
    self addOpt(m, "Sub Menu 4", ::subMenu, "Sub Menu 4");
    self addOpt(m, "Sub Menu 5", ::subMenu, "Sub Menu 5");
    self addOpt(m, "Sub Menu 6", ::subMenu, "Sub Menu 6");
    self addOpt(m, "Sub Menu 7", ::subMenu, "Sub Menu 7");
    self addOpt(m, "Sub Menu 8", ::subMenu, "Sub Menu 8");
    self addOpt(m, "Sub Menu 9", ::subMenu, "Sub Menu 9");
    self addOpt(m, "Verification Menu", ::subMenu, "Verification");
 
    m = "Sub Menu 1";
    self addMenu(m, "Sub Menu 1", "main");
    self addOpt(m, "God Mode", ::godMode);
    self addOpt(m, "Test Option 1", ::test);
    self addOpt(m, "Test Option 2", ::test);
    self addOpt(m, "Test Option 3", ::test);
    self addOpt(m, "Test Option 4", ::test);
    self addOpt(m, "Test Option 5", ::test);
    self addOpt(m, "Test Option 6", ::test);
    self addOpt(m, "Test Option 7", ::test);
    self addOpt(m, "Test Option 8", ::test);
 
    m = "Sub Menu 2";
    self addMenu(m, "Sub Menu 2", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 3";
    self addMenu(m, "Sub Menu 3", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 4";
    self addMenu(m, "Sub Menu 4", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 5";
    self addMenu(m, "Sub Menu 5", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 6";
    self addMenu(m, "Sub Menu 6", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 7";
    self addMenu(m, "Sub Menu 7", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 8";
    self addMenu(m, "Sub Menu 8", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 9";
    self addMenu(m, "Sub Menu 9", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Verification";
    self addMenu(m, "Verification Menu", "main");
    for(e = 0; e < level.players.size; e++)
    {
        guy = level.players[e];
        name = guy.name;
        menu = "veri_"+name;
 
        if(e == 0 && self != level.players[0])
            continue;
        self addOpt(m, level.players[e].name, ::subMenu, menu);
 
        self addMenu(menu, name+"'s Options:", "veri");
        self addOpt(menu, "Set To: Client", ::setStatus, guy, "Client");
        self addOpt(menu, "Set To: Vip", ::setStatus, guy, "Vip");
        self addOpt(menu, "Set To: Admin", ::setStatus, guy, "Admin");
    }
}
 
initMenu()
{
    self endon("death");
    self endon("disconnect");
    self.openBox = self createRectangle("TOP", "TOP", 0, 2, 300, 30, (0, 0, 0), "white", 1, .7);
    self.openText = self createText("default", 1.5, "TOP", "TOP", 0, 8, 2, 1, (1, 0, 0), "Press [{+smoke}] To Open Menu");
    self.currentMenu = "main";
    self.menuCurs = 0;
    for(;;)
    {
        if(self secondaryOffHandButtonPressed())
        {
            if(!isDefined(self.inMenu))
            {
                self.inMenu = true;
                self thread deleteOffHand();
                self.openText.glowColor = (0, 1, 0);
                self.openText thread changeFontScaleOverTime(.4, 2);
                self.openText moveOverTime(.4);
                self.openText.y+= 5;
                self initMenuOpts();
                menuOpts = self.menuAction[self.currentMenu].opt.size;
                self.openBox scaleOverTime(.4, 300, ((menuOpts*19)+45));
                wait .4;
                self.openText setText(self.menuAction[self.currentMenu].title);
                string = "";
                for(m = 0; m < menuOpts; m++)
                    string+= self.menuAction[self.currentMenu].opt[m]+"\n";
                self.menuText = self createText("default", 1.5, "LEFT", "TOP", -130, 50, 3, 1, undefined, string);
                self.scrollBar = self createRectangle("TOP", "TOP", 0, ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2))), 300, 15, (0, 255, 0), "white", 2, .7);
            }
        }
        if(isDefined(self.inMenu))
        {
            if(self attackButtonPressed())
            {
                self.menuCurs++;
                if(self.menuCurs > self.menuAction[self.currentMenu].opt.size-1)
                    self.menuCurs = 0;
                self.scrollBar moveOverTime(.15);
                self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
                wait .15;
            }
            if(self adsButtonPressed())
            {
                self.menuCurs--;
                if(self.menuCurs < 0)
                    self.menuCurs = self.menuAction[self.currentMenu].opt.size-1;
                self.scrollBar moveOverTime(.15);
                self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
                wait .15;
            }
            if(self useButtonPressed())
            {
                self thread [[self.menuAction[self.currentMenu].func[self.menuCurs]]](self.menuAction[self.currentMenu].inp[self.menuCurs]);
                wait .2;
            }
            if(self meleeButtonPressed())
            {
                if(!isDefined(self.menuAction[self.currentMenu].parent))
                {
                    self.inMenu = undefined;
                    self.menuCurs = 0;
                    self.openText.glowColor = (0, 1, 0);
                    self.openText thread changeFontScaleOverTime(.4, 1.5);
                    self.openText moveOverTime(.4);
                    self.openText.y-= 5;
                    self.openBox scaleOverTime(.4, 300, 30);
                    self.menuText destroy();
                    self.scrollBar destroy();
                    wait .4;
                    self.openText.glowColor = (1, 0, 0);
                    self.openText setText("Press [{+smoke}] To Open Menu");
                }
                else
                    self subMenu(self.menuAction[self.currentMenu].parent);
            }
        }
        wait .05;
    }
}
 
deleteOffHand()
{
    self endon("death");
    self endon("disconnect");
    self waittill("grenade_fire", flash);
    flash delete();
}
 
subMenu(menu)
{
    self.menuCurs = 0;
    self.currentMenu = menu;
    self.scrollBar moveOverTime(.2);
    self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
    self.menuText destroy();
    self initMenuOpts();
    self.openText setText(self.menuAction[self.currentMenu].title);
    menuOpts = self.menuAction[self.currentMenu].opt.size;
    self.openBox scaleOverTime(.2, 300, ((menuOpts*19)+45));
    wait .2;
    string = "";
    for(m = 0; m < menuOpts; m++)
        string+= self.menuAction[self.currentMenu].opt[m]+"\n";
    self.menuText = self createText("default", 1.5, "LEFT", "TOP", -130, 50, 3, 1, undefined, string);
    wait .2;
}
 
test(inp)
{
    self iPrintln("Menu Base by ^2mikeeeeyy");
    self iPrintln("Ported from cod 4 to bo2");
    self iPrintln("By ^5Extinct ^7and ^6Rezhified");
}
 
godMode()
{
    if(!isDefined(self.godMode))
    {
        self.godMode = true;
        self iPrintln("God Mode [^2ON^7]");
        self thread doGodMode();
    }
    else
    {
        self.godMode = undefined;
        self iPrintln("God Mode [^1OFF^7]");
        self.health = 100;
        self.maxhealth = 100;
        self notify("godMode_over");
    }
}
 
doGodMode()
{
    self endon("death");
    self endon("disconnect");
    self endon("godMode_over");
    for(;;)
    {
        self.health = 999999;
        self.maxhealth = 999999;
        wait .05;
    }
}
 
setStatus(guy, status)
{
    guy.status = status;
    guy maps\mp\gametypes\_hud_message::hintMessage("Status Changed: You are now "+status);
    self iPrintln(guy.name+" Is Now "+status);
    guy suicide();
}
 
addMenu(menu, title, parent)
{
    if(!isDefined(self.menuAction))
        self.menuAction = [];
    self.menuAction[menu] = spawnStruct();
    self.menuAction[menu].title = title;
    self.menuAction[menu].parent = parent;
    self.menuAction[menu].opt = [];
    self.menuAction[menu].func = [];
    self.menuAction[menu].inp = [];
}
 
addOpt(menu, opt, func, inp, inp1)
{
    m = self.menuAction[menu].opt.size;
    self.menuAction[menu].opt[m] = opt;
    self.menuAction[menu].func[m] = func;
    self.menuAction[menu].inp[m] = inp;
    self.menuAction[menu].inp1[m] = inp1;
}
 
changeFontScaleOverTime(time, scale)
{
    start = self.fontscale;
    frames = (time / .05);
    scaleChange = (scale-start);
    scaleChangePer = (scaleChange/frames);
    for(m = 0; m < frames; m++)
    {
        self.fontscale+= scaleChangePer;
        wait .05;
    }
}
 
createText(font, fontScale, align, relative, x, y, sort, alpha, glow, text)
{
    textElem = self createFontString(font, fontScale);
    textElem setPoint(align, relative, x, y);
    textElem.sort = sort;
    textElem.alpha = alpha;
    textElem.glowColor = glow;
    textElem.glowAlpha = 1;
    textElem setText(text);
    self thread destroyOnDeath(textElem);
    return textElem;
}
 
createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha)
{
    boxElem = newClientHudElem(self);
    boxElem.elemType = "bar";
    if(!level.splitScreen)
    {
        boxElem.x = -2;
        boxElem.y = -2;
    }
    boxElem.width = width;
    boxElem.height = height;
    boxElem.align = align;
    boxElem.relative = relative;
    boxElem.xOffset = 0;
    boxElem.yOffset = 0;
    boxElem.children = [];
    boxElem.sort = sort;
    boxElem.color = color;
    boxElem.alpha = alpha;
    boxElem setParent(level.uiParent);
    boxElem setShader(shader, width, height);
    boxElem.hidden = false;
    boxElem setPoint(align, relative, x, y);
    self thread destroyOnDeath(boxElem);
    return boxElem;
}
 
destroyOnDeath(elem)
{
    self waittill_any("death", "disconnect");
    if(isDefined(elem.bar))
        elem destroyElem();
    else
        elem destroy();
    if(isDefined(elem.model))
        elem delete();
}

Video Link:

Credits:
Rezhified
Extinct
Mikeeeyy
Erm. No
 
L

LowKeyDNS

Guest
Code:
/*
*    Black Ops 2 - GSC Studio by iMCSx
*
*    Creator : Rezhified/Extinct
*    Project : menu base port
*    Mode : Multiplayer
*    Date : 2016/12/05 - 20:04:55
*
*/
 
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;
#include maps\mp\gametypes\_hud_message;
 
init()
{
    level thread onPlayerConnect();
}
 
onPlayerConnect()
{
    for(;;)
    {
        level waittill("connected", player);
        player thread onPlayerSpawned();
    }
}
 
onPlayerSpawned()
{
    self endon("disconnect");
    self.status = "Client";
    if(self == level.players[0])
        self.status = "Admin";
    for(;;)
    {
        self waittill("spawned_player");
        self.inMenu = undefined;
        self thread initMenu();
    }
}
 
initMenuOpts()
{
    m = "main";
    self addMenu(m, "Main Menu", undefined);
    self addOpt(m, "Sub Menu 1", ::subMenu, "Sub Menu 1");
    self addOpt(m, "Sub Menu 2", ::subMenu, "Sub Menu 2");
    self addOpt(m, "Sub Menu 3", ::subMenu, "Sub Menu 3");
    self addOpt(m, "Sub Menu 4", ::subMenu, "Sub Menu 4");
    self addOpt(m, "Sub Menu 5", ::subMenu, "Sub Menu 5");
    self addOpt(m, "Sub Menu 6", ::subMenu, "Sub Menu 6");
    self addOpt(m, "Sub Menu 7", ::subMenu, "Sub Menu 7");
    self addOpt(m, "Sub Menu 8", ::subMenu, "Sub Menu 8");
    self addOpt(m, "Sub Menu 9", ::subMenu, "Sub Menu 9");
    self addOpt(m, "Verification Menu", ::subMenu, "Verification");
 
    m = "Sub Menu 1";
    self addMenu(m, "Sub Menu 1", "main");
    self addOpt(m, "God Mode", ::godMode);
    self addOpt(m, "Test Option 1", ::test);
    self addOpt(m, "Test Option 2", ::test);
    self addOpt(m, "Test Option 3", ::test);
    self addOpt(m, "Test Option 4", ::test);
    self addOpt(m, "Test Option 5", ::test);
    self addOpt(m, "Test Option 6", ::test);
    self addOpt(m, "Test Option 7", ::test);
    self addOpt(m, "Test Option 8", ::test);
 
    m = "Sub Menu 2";
    self addMenu(m, "Sub Menu 2", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 3";
    self addMenu(m, "Sub Menu 3", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 4";
    self addMenu(m, "Sub Menu 4", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 5";
    self addMenu(m, "Sub Menu 5", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 6";
    self addMenu(m, "Sub Menu 6", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 7";
    self addMenu(m, "Sub Menu 7", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 8";
    self addMenu(m, "Sub Menu 8", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 9";
    self addMenu(m, "Sub Menu 9", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Verification";
    self addMenu(m, "Verification Menu", "main");
    for(e = 0; e < level.players.size; e++)
    {
        guy = level.players[e];
        name = guy.name;
        menu = "veri_"+name;
 
        if(e == 0 && self != level.players[0])
            continue;
        self addOpt(m, level.players[e].name, ::subMenu, menu);
 
        self addMenu(menu, name+"'s Options:", "veri");
        self addOpt(menu, "Set To: Client", ::setStatus, guy, "Client");
        self addOpt(menu, "Set To: Vip", ::setStatus, guy, "Vip");
        self addOpt(menu, "Set To: Admin", ::setStatus, guy, "Admin");
    }
}
 
initMenu()
{
    self endon("death");
    self endon("disconnect");
    self.openBox = self createRectangle("TOP", "TOP", 0, 2, 300, 30, (0, 0, 0), "white", 1, .7);
    self.openText = self createText("default", 1.5, "TOP", "TOP", 0, 8, 2, 1, (1, 0, 0), "Press [{+smoke}] To Open Menu");
    self.currentMenu = "main";
    self.menuCurs = 0;
    for(;;)
    {
        if(self secondaryOffHandButtonPressed())
        {
            if(!isDefined(self.inMenu))
            {
                self.inMenu = true;
                self thread deleteOffHand();
                self.openText.glowColor = (0, 1, 0);
                self.openText thread changeFontScaleOverTime(.4, 2);
                self.openText moveOverTime(.4);
                self.openText.y+= 5;
                self initMenuOpts();
                menuOpts = self.menuAction[self.currentMenu].opt.size;
                self.openBox scaleOverTime(.4, 300, ((menuOpts*19)+45));
                wait .4;
                self.openText setText(self.menuAction[self.currentMenu].title);
                string = "";
                for(m = 0; m < menuOpts; m++)
                    string+= self.menuAction[self.currentMenu].opt[m]+"\n";
                self.menuText = self createText("default", 1.5, "LEFT", "TOP", -130, 50, 3, 1, undefined, string);
                self.scrollBar = self createRectangle("TOP", "TOP", 0, ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2))), 300, 15, (0, 255, 0), "white", 2, .7);
            }
        }
        if(isDefined(self.inMenu))
        {
            if(self attackButtonPressed())
            {
                self.menuCurs++;
                if(self.menuCurs > self.menuAction[self.currentMenu].opt.size-1)
                    self.menuCurs = 0;
                self.scrollBar moveOverTime(.15);
                self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
                wait .15;
            }
            if(self adsButtonPressed())
            {
                self.menuCurs--;
                if(self.menuCurs < 0)
                    self.menuCurs = self.menuAction[self.currentMenu].opt.size-1;
                self.scrollBar moveOverTime(.15);
                self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
                wait .15;
            }
            if(self useButtonPressed())
            {
                self thread [[self.menuAction[self.currentMenu].func[self.menuCurs]]](self.menuAction[self.currentMenu].inp[self.menuCurs]);
                wait .2;
            }
            if(self meleeButtonPressed())
            {
                if(!isDefined(self.menuAction[self.currentMenu].parent))
                {
                    self.inMenu = undefined;
                    self.menuCurs = 0;
                    self.openText.glowColor = (0, 1, 0);
                    self.openText thread changeFontScaleOverTime(.4, 1.5);
                    self.openText moveOverTime(.4);
                    self.openText.y-= 5;
                    self.openBox scaleOverTime(.4, 300, 30);
                    self.menuText destroy();
                    self.scrollBar destroy();
                    wait .4;
                    self.openText.glowColor = (1, 0, 0);
                    self.openText setText("Press [{+smoke}] To Open Menu");
                }
                else
                    self subMenu(self.menuAction[self.currentMenu].parent);
            }
        }
        wait .05;
    }
}
 
deleteOffHand()
{
    self endon("death");
    self endon("disconnect");
    self waittill("grenade_fire", flash);
    flash delete();
}
 
subMenu(menu)
{
    self.menuCurs = 0;
    self.currentMenu = menu;
    self.scrollBar moveOverTime(.2);
    self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
    self.menuText destroy();
    self initMenuOpts();
    self.openText setText(self.menuAction[self.currentMenu].title);
    menuOpts = self.menuAction[self.currentMenu].opt.size;
    self.openBox scaleOverTime(.2, 300, ((menuOpts*19)+45));
    wait .2;
    string = "";
    for(m = 0; m < menuOpts; m++)
        string+= self.menuAction[self.currentMenu].opt[m]+"\n";
    self.menuText = self createText("default", 1.5, "LEFT", "TOP", -130, 50, 3, 1, undefined, string);
    wait .2;
}
 
test(inp)
{
    self iPrintln("Menu Base by ^2mikeeeeyy");
    self iPrintln("Ported from cod 4 to bo2");
    self iPrintln("By ^5Extinct ^7and ^6Rezhified");
}
 
godMode()
{
    if(!isDefined(self.godMode))
    {
        self.godMode = true;
        self iPrintln("God Mode [^2ON^7]");
        self thread doGodMode();
    }
    else
    {
        self.godMode = undefined;
        self iPrintln("God Mode [^1OFF^7]");
        self.health = 100;
        self.maxhealth = 100;
        self notify("godMode_over");
    }
}
 
doGodMode()
{
    self endon("death");
    self endon("disconnect");
    self endon("godMode_over");
    for(;;)
    {
        self.health = 999999;
        self.maxhealth = 999999;
        wait .05;
    }
}
 
setStatus(guy, status)
{
    guy.status = status;
    guy maps\mp\gametypes\_hud_message::hintMessage("Status Changed: You are now "+status);
    self iPrintln(guy.name+" Is Now "+status);
    guy suicide();
}
 
addMenu(menu, title, parent)
{
    if(!isDefined(self.menuAction))
        self.menuAction = [];
    self.menuAction[menu] = spawnStruct();
    self.menuAction[menu].title = title;
    self.menuAction[menu].parent = parent;
    self.menuAction[menu].opt = [];
    self.menuAction[menu].func = [];
    self.menuAction[menu].inp = [];
}
 
addOpt(menu, opt, func, inp, inp1)
{
    m = self.menuAction[menu].opt.size;
    self.menuAction[menu].opt[m] = opt;
    self.menuAction[menu].func[m] = func;
    self.menuAction[menu].inp[m] = inp;
    self.menuAction[menu].inp1[m] = inp1;
}
 
changeFontScaleOverTime(time, scale)
{
    start = self.fontscale;
    frames = (time / .05);
    scaleChange = (scale-start);
    scaleChangePer = (scaleChange/frames);
    for(m = 0; m < frames; m++)
    {
        self.fontscale+= scaleChangePer;
        wait .05;
    }
}
 
createText(font, fontScale, align, relative, x, y, sort, alpha, glow, text)
{
    textElem = self createFontString(font, fontScale);
    textElem setPoint(align, relative, x, y);
    textElem.sort = sort;
    textElem.alpha = alpha;
    textElem.glowColor = glow;
    textElem.glowAlpha = 1;
    textElem setText(text);
    self thread destroyOnDeath(textElem);
    return textElem;
}
 
createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha)
{
    boxElem = newClientHudElem(self);
    boxElem.elemType = "bar";
    if(!level.splitScreen)
    {
        boxElem.x = -2;
        boxElem.y = -2;
    }
    boxElem.width = width;
    boxElem.height = height;
    boxElem.align = align;
    boxElem.relative = relative;
    boxElem.xOffset = 0;
    boxElem.yOffset = 0;
    boxElem.children = [];
    boxElem.sort = sort;
    boxElem.color = color;
    boxElem.alpha = alpha;
    boxElem setParent(level.uiParent);
    boxElem setShader(shader, width, height);
    boxElem.hidden = false;
    boxElem setPoint(align, relative, x, y);
    self thread destroyOnDeath(boxElem);
    return boxElem;
}
 
destroyOnDeath(elem)
{
    self waittill_any("death", "disconnect");
    if(isDefined(elem.bar))
        elem destroyElem();
    else
        elem destroy();
    if(isDefined(elem.model))
        elem delete();
}

Video Link:

Credits:
Rezhified
Extinct
Mikeeeyy
Nice Menu! Even if it is a port, I really like it!
 

Lucifer

Veteran
Messages
770
Reaction score
499
Points
878
Code:
/*
*    Black Ops 2 - GSC Studio by iMCSx
*
*    Creator : Rezhified/Extinct
*    Project : menu base port
*    Mode : Multiplayer
*    Date : 2016/12/05 - 20:04:55
*
*/
 
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;
#include maps\mp\gametypes\_hud_message;
 
init()
{
    level thread onPlayerConnect();
}
 
onPlayerConnect()
{
    for(;;)
    {
        level waittill("connected", player);
        player thread onPlayerSpawned();
    }
}
 
onPlayerSpawned()
{
    self endon("disconnect");
    self.status = "Client";
    if(self == level.players[0])
        self.status = "Admin";
    for(;;)
    {
        self waittill("spawned_player");
        self.inMenu = undefined;
        self thread initMenu();
    }
}
 
initMenuOpts()
{
    m = "main";
    self addMenu(m, "Main Menu", undefined);
    self addOpt(m, "Sub Menu 1", ::subMenu, "Sub Menu 1");
    self addOpt(m, "Sub Menu 2", ::subMenu, "Sub Menu 2");
    self addOpt(m, "Sub Menu 3", ::subMenu, "Sub Menu 3");
    self addOpt(m, "Sub Menu 4", ::subMenu, "Sub Menu 4");
    self addOpt(m, "Sub Menu 5", ::subMenu, "Sub Menu 5");
    self addOpt(m, "Sub Menu 6", ::subMenu, "Sub Menu 6");
    self addOpt(m, "Sub Menu 7", ::subMenu, "Sub Menu 7");
    self addOpt(m, "Sub Menu 8", ::subMenu, "Sub Menu 8");
    self addOpt(m, "Sub Menu 9", ::subMenu, "Sub Menu 9");
    self addOpt(m, "Verification Menu", ::subMenu, "Verification");
 
    m = "Sub Menu 1";
    self addMenu(m, "Sub Menu 1", "main");
    self addOpt(m, "God Mode", ::godMode);
    self addOpt(m, "Test Option 1", ::test);
    self addOpt(m, "Test Option 2", ::test);
    self addOpt(m, "Test Option 3", ::test);
    self addOpt(m, "Test Option 4", ::test);
    self addOpt(m, "Test Option 5", ::test);
    self addOpt(m, "Test Option 6", ::test);
    self addOpt(m, "Test Option 7", ::test);
    self addOpt(m, "Test Option 8", ::test);
 
    m = "Sub Menu 2";
    self addMenu(m, "Sub Menu 2", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 3";
    self addMenu(m, "Sub Menu 3", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 4";
    self addMenu(m, "Sub Menu 4", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 5";
    self addMenu(m, "Sub Menu 5", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 6";
    self addMenu(m, "Sub Menu 6", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 7";
    self addMenu(m, "Sub Menu 7", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 8";
    self addMenu(m, "Sub Menu 8", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Sub Menu 9";
    self addMenu(m, "Sub Menu 9", "main");
    self addOpt(m, "Test Option 1", ::test);
 
    m = "Verification";
    self addMenu(m, "Verification Menu", "main");
    for(e = 0; e < level.players.size; e++)
    {
        guy = level.players[e];
        name = guy.name;
        menu = "veri_"+name;
 
        if(e == 0 && self != level.players[0])
            continue;
        self addOpt(m, level.players[e].name, ::subMenu, menu);
 
        self addMenu(menu, name+"'s Options:", "veri");
        self addOpt(menu, "Set To: Client", ::setStatus, guy, "Client");
        self addOpt(menu, "Set To: Vip", ::setStatus, guy, "Vip");
        self addOpt(menu, "Set To: Admin", ::setStatus, guy, "Admin");
    }
}
 
initMenu()
{
    self endon("death");
    self endon("disconnect");
    self.openBox = self createRectangle("TOP", "TOP", 0, 2, 300, 30, (0, 0, 0), "white", 1, .7);
    self.openText = self createText("default", 1.5, "TOP", "TOP", 0, 8, 2, 1, (1, 0, 0), "Press [{+smoke}] To Open Menu");
    self.currentMenu = "main";
    self.menuCurs = 0;
    for(;;)
    {
        if(self secondaryOffHandButtonPressed())
        {
            if(!isDefined(self.inMenu))
            {
                self.inMenu = true;
                self thread deleteOffHand();
                self.openText.glowColor = (0, 1, 0);
                self.openText thread changeFontScaleOverTime(.4, 2);
                self.openText moveOverTime(.4);
                self.openText.y+= 5;
                self initMenuOpts();
                menuOpts = self.menuAction[self.currentMenu].opt.size;
                self.openBox scaleOverTime(.4, 300, ((menuOpts*19)+45));
                wait .4;
                self.openText setText(self.menuAction[self.currentMenu].title);
                string = "";
                for(m = 0; m < menuOpts; m++)
                    string+= self.menuAction[self.currentMenu].opt[m]+"\n";
                self.menuText = self createText("default", 1.5, "LEFT", "TOP", -130, 50, 3, 1, undefined, string);
                self.scrollBar = self createRectangle("TOP", "TOP", 0, ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2))), 300, 15, (0, 255, 0), "white", 2, .7);
            }
        }
        if(isDefined(self.inMenu))
        {
            if(self attackButtonPressed())
            {
                self.menuCurs++;
                if(self.menuCurs > self.menuAction[self.currentMenu].opt.size-1)
                    self.menuCurs = 0;
                self.scrollBar moveOverTime(.15);
                self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
                wait .15;
            }
            if(self adsButtonPressed())
            {
                self.menuCurs--;
                if(self.menuCurs < 0)
                    self.menuCurs = self.menuAction[self.currentMenu].opt.size-1;
                self.scrollBar moveOverTime(.15);
                self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
                wait .15;
            }
            if(self useButtonPressed())
            {
                self thread [[self.menuAction[self.currentMenu].func[self.menuCurs]]](self.menuAction[self.currentMenu].inp[self.menuCurs]);
                wait .2;
            }
            if(self meleeButtonPressed())
            {
                if(!isDefined(self.menuAction[self.currentMenu].parent))
                {
                    self.inMenu = undefined;
                    self.menuCurs = 0;
                    self.openText.glowColor = (0, 1, 0);
                    self.openText thread changeFontScaleOverTime(.4, 1.5);
                    self.openText moveOverTime(.4);
                    self.openText.y-= 5;
                    self.openBox scaleOverTime(.4, 300, 30);
                    self.menuText destroy();
                    self.scrollBar destroy();
                    wait .4;
                    self.openText.glowColor = (1, 0, 0);
                    self.openText setText("Press [{+smoke}] To Open Menu");
                }
                else
                    self subMenu(self.menuAction[self.currentMenu].parent);
            }
        }
        wait .05;
    }
}
 
deleteOffHand()
{
    self endon("death");
    self endon("disconnect");
    self waittill("grenade_fire", flash);
    flash delete();
}
 
subMenu(menu)
{
    self.menuCurs = 0;
    self.currentMenu = menu;
    self.scrollBar moveOverTime(.2);
    self.scrollBar.y = ((self.menuCurs*17.98)+((self.menuText.y+1)-(17.98/2)));
    self.menuText destroy();
    self initMenuOpts();
    self.openText setText(self.menuAction[self.currentMenu].title);
    menuOpts = self.menuAction[self.currentMenu].opt.size;
    self.openBox scaleOverTime(.2, 300, ((menuOpts*19)+45));
    wait .2;
    string = "";
    for(m = 0; m < menuOpts; m++)
        string+= self.menuAction[self.currentMenu].opt[m]+"\n";
    self.menuText = self createText("default", 1.5, "LEFT", "TOP", -130, 50, 3, 1, undefined, string);
    wait .2;
}
 
test(inp)
{
    self iPrintln("Menu Base by ^2mikeeeeyy");
    self iPrintln("Ported from cod 4 to bo2");
    self iPrintln("By ^5Extinct ^7and ^6Rezhified");
}
 
godMode()
{
    if(!isDefined(self.godMode))
    {
        self.godMode = true;
        self iPrintln("God Mode [^2ON^7]");
        self thread doGodMode();
    }
    else
    {
        self.godMode = undefined;
        self iPrintln("God Mode [^1OFF^7]");
        self.health = 100;
        self.maxhealth = 100;
        self notify("godMode_over");
    }
}
 
doGodMode()
{
    self endon("death");
    self endon("disconnect");
    self endon("godMode_over");
    for(;;)
    {
        self.health = 999999;
        self.maxhealth = 999999;
        wait .05;
    }
}
 
setStatus(guy, status)
{
    guy.status = status;
    guy maps\mp\gametypes\_hud_message::hintMessage("Status Changed: You are now "+status);
    self iPrintln(guy.name+" Is Now "+status);
    guy suicide();
}
 
addMenu(menu, title, parent)
{
    if(!isDefined(self.menuAction))
        self.menuAction = [];
    self.menuAction[menu] = spawnStruct();
    self.menuAction[menu].title = title;
    self.menuAction[menu].parent = parent;
    self.menuAction[menu].opt = [];
    self.menuAction[menu].func = [];
    self.menuAction[menu].inp = [];
}
 
addOpt(menu, opt, func, inp, inp1)
{
    m = self.menuAction[menu].opt.size;
    self.menuAction[menu].opt[m] = opt;
    self.menuAction[menu].func[m] = func;
    self.menuAction[menu].inp[m] = inp;
    self.menuAction[menu].inp1[m] = inp1;
}
 
changeFontScaleOverTime(time, scale)
{
    start = self.fontscale;
    frames = (time / .05);
    scaleChange = (scale-start);
    scaleChangePer = (scaleChange/frames);
    for(m = 0; m < frames; m++)
    {
        self.fontscale+= scaleChangePer;
        wait .05;
    }
}
 
createText(font, fontScale, align, relative, x, y, sort, alpha, glow, text)
{
    textElem = self createFontString(font, fontScale);
    textElem setPoint(align, relative, x, y);
    textElem.sort = sort;
    textElem.alpha = alpha;
    textElem.glowColor = glow;
    textElem.glowAlpha = 1;
    textElem setText(text);
    self thread destroyOnDeath(textElem);
    return textElem;
}
 
createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha)
{
    boxElem = newClientHudElem(self);
    boxElem.elemType = "bar";
    if(!level.splitScreen)
    {
        boxElem.x = -2;
        boxElem.y = -2;
    }
    boxElem.width = width;
    boxElem.height = height;
    boxElem.align = align;
    boxElem.relative = relative;
    boxElem.xOffset = 0;
    boxElem.yOffset = 0;
    boxElem.children = [];
    boxElem.sort = sort;
    boxElem.color = color;
    boxElem.alpha = alpha;
    boxElem setParent(level.uiParent);
    boxElem setShader(shader, width, height);
    boxElem.hidden = false;
    boxElem setPoint(align, relative, x, y);
    self thread destroyOnDeath(boxElem);
    return boxElem;
}
 
destroyOnDeath(elem)
{
    self waittill_any("death", "disconnect");
    if(isDefined(elem.bar))
        elem destroyElem();
    else
        elem destroy();
    if(isDefined(elem.model))
        elem delete();
}

Video Link:

Credits:
Rezhified
Extinct
Mikeeeyy
This base looks very nice good work :smile:
 
Top