Aspire

Known Member
Messages
31
Points
118
This pretty much is Shark's GSC menu base for BO2 ported to Black Ops 3.
I ported it over to Black Ops 3 hoping it would help some people.
I tried to keep it as simple as possible so I'd it's perfect for beginners.

Anyways if you have any ideas on how to improve/fix this base just reply.
------------------------------------------------------------------------------------

You have to be logged in to view links Log in or register now.


------------------------------------------------------------------------------------

Main
Code:
#using scripts\mp\_util;
#using scripts\codescripts\struct;
#using scripts\shared\util_shared;
#using scripts\shared\system_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\_hud_util_shared;
#using scripts\shared\_hud_message_shared;
#insert scripts\shared\shared.gsh;
#namespace clientids;

REGISTER_SYSTEM( "clientids", &__init__, undefined )
 
function __init__()
{
    callback::on_start_gametype( &init );
    callback::on_connect( &on_player_connect );
}

//Based on shark's base

function init()
{
    enableDebugMode(true);
    if(!isDefined(level.players))
    {
        level thread initPerms();
    }

    level.clientid = 0; //dont know if I have to leave it in
    level thread removeSkyBarrier();
}

function on_player_connect()
{
    //dont know if I should leave it in
    self.clientid = matchRecordNewPlayer( self );
    if(!isdefined( self.clientid ) || self.clientid == -1)
    {
        self.clientid = level.clientid;
        level.clientid++;
    }

    if(self IsHost() || self IsLocalToHost())
        self.menuControls = true; //should be here as long as homefront is diabled
        //self thread homefront(); //disabled for now

    self thread onSpawn();
}

function onSpawn()
{
    self endon("disconnect");
    level endon("game_ended");

    self.MenuOpen = false;
    self.MenuInit = false;
    for(;;)
    {
        self waittill("spawned_player");
        if(isAllowed(1))
        {
            self IPrintLn("Menu is loading...");
            self thread welcome();
            if(!self.MenuInit)
            {
                self.vars = [];
                self.MenuInit = true;
                self thread initVars();
                self thread MenuInit();
                self thread closeOnDeath();
            }
        }
    }
}

function enableDebugMode(toggle)
{
    level.debug = toggle;
}

Verification System:
Code:
function initPerms()
{
    level.AccessLevel = [];
    level.AccessLevel[0] = "No Access";
    level.AccessLevel[1] = "Access Level 1";
    level.AccessLevel[2] = "Access Level 2";
    level.AccessLevel[3] = "Access Level 3";
    level.AccessLevel[4] = "Access Level 4";

    foreach(player in level.players)
    {
        if(player ishost())
            player.AccessLevel = level.AccessLevel[4];
        else
            player.AccessLevel = level.AccessLevel[0];
    }
}

function verToNum(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
            return 4;
            break;

        case level.AccessLevel[3]:
            return 3;
            break;

        case level.AccessLevel[2]:
            return 2;
            break;

        case level.AccessLevel[1]:
            return 1;
            break;

        default:
            return 0;
    }
}

function verToCol(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
           return "^1Access Level 4^7";
            break;

        case level.AccessLevel[3]:
           return "^1Access Level 3^7";
            break;

        case level.AccessLevel[2]:
           return "^1Access Level 2^7";
            break;

        case level.AccessLevel[1]:
           return "^1Access Level 1^7";
            break;

        default:
           return "^7No Access";
}

function isAllowed(n)
{
    return (verToNum(player.AccessLevel) >= n);
}

function verify(player, n)
{
    if(verToNum(self.AccessLevel) >= verToNum(player.AccessLevel))
    {
        if(player.AccessLevel != n)
        {
            if(!player IsHost())
            {
                player.AccessLevel = n;
     
                self.menu.title destroy();
                self.menu.title = drawText(getName(player) + " [" + verToCol(player.AccessLevel) + "^7]", "default", 2, 280, 30, (1, 1, 1), 0, (0, 0.58, 1), 1, 3);
                self.menu.title FadeOverTime(0.3);
                self.menu.title.alpha = 1;
 
                if(player.AccessLevel == "No Access")
                    self thread destroyMenu(player);
 
                self iPrintln("Set " + verToCol(n) + " For " + getName(player));
                player iPrintln("Set " + verToCol(n) + " For " + self.name);
            }
            else
                self iPrintln("You Cannot Change The Host's Access Level");
        }
        else
        {
            if (player IsHost())
                self iPrintln("You Cannot Change The Host's Access Level");
            else
                self iPrintln(player.name + " Has Already " + verToCol(n));
        }
    }
    else
        self IPrintLn("He Has " + verToCol(player.AccessLevel) + ". You Cannot Change His Access Level!");
}

function destroyMenu(player)
{
    player.MenuInit = false;
    closeMenu();
 
    wait 0.3;
 
    for(i=0; i < self.menu.menuopt[player.menu.currentmenu].size; i++)
    { player.menu.opt[i] destroy(); }
 
    player.menu.background destroy();
    player.menu.scroller destroy();
    player.menu.line destroy();
    player.menu.title destroy();
    player notify("destroyMenu");
}

Controls/Monitoring:
Code:
function MenuInit()
{
    self endon("disconnect");
    self endon("destroyMenu");
    level endon("game_ended");
 
    self.menu = SpawnStruct();
    self.toggles = SpawnStruct();
 
    self.MenuOpen = false;
 
    self StoreShaders();
    self CreateMenu();
 
    for(;;)
    {
        if(!self.MenuOpen && self.menuControls)
        {
            if(self MeleeButtonPressed() && self AdsButtonPressed())
            {
                openMenu();
                updateClients();
            }
        }
        if(self.menu.open)
        {
            if(self UseButtonPressed())
            {
                if(isDefined(self.menu.previousmenu[self.menu.currentmenu]))
                {
                    self submenu(self.menu.previousmenu[self.menu.currentmenu]);
                }
                else
                {
                    closeMenu();
                }
                self PlayLocalSound("");
                wait 0.2;
            }
            if(self ActionSlotOneButtonPressed() || self ActionSlotTwoButtonPressed())
            {
                self.menu.curs[self.menu.currentmenu] += (Iif(self ActionSlotTwoButtonPressed(), 1, -1));
                self.menu.curs[self.menu.currentmenu] = (Iif(self.menu.curs[self.menu.currentmenu] < 0, self.menu.menuopt[self.menu.currentmenu].size-1, Iif(self.menu.curs[self.menu.currentmenu] > self.menu.menuopt[self.menu.currentmenu].size-1, 0, self.menu.curs[self.menu.currentmenu])));
         
                self.menu.scroller MoveOverTime(0.15);
                self.menu.scroller.y = self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1;
                //self.menu.scroller elemMove(0.15, "y", self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1);
                self PlayLocalSound("");
            }
            if(self JumpButtonPressed())
            {
                self thread [[self.menu.menufunc[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]]]](self.menu.menuinput[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]], self.menu.menuinput1[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]]);
                self PlayLocalSound("");
                wait 0.2;
            }
        }
        wait 0.05;
    }
}

Menu:
Code:
function CreateMenu()
{
    self addMenu(undefined, "Main Menu", level.AccessLevel[0]);
    self addOption("Main Menu", "SubMenu 1", &submenu, "SubMenu 1", "SubMenu 1");
    self addOption("Main Menu", "SubMenu 2", &submenu, "SubMenu 2", "SubMenu 2");
    self addOption("Main Menu", "SubMenu 3", &submenu, "SubMenu 3", "SubMenu 3");

    self addMenu("Main Menu", "SubMenu 1", level.AccessLevel[1]);
    self addOption("SubMenu 1", "Option 1", &test);
    self addOption("SubMenu 1", "Option 2", &test);
    self addOption("SubMenu 1", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 2", level.AccessLevel[1]);
    self addOption("SubMenu 2", "Option 1", &test);
    self addOption("SubMenu 2", "Option 2", &test);
    self addOption("SubMenu 2", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 3", level.AccessLevel[1]);
    self addOption("SubMenu 3", "Option 1", &test);
    self addOption("SubMenu 3", "Option 2", &test);
    self addOption("SubMenu 3", "Option 3", &test);


    self addMenu("Main Menu", "PlayersMenu", level.AccessLevel[4]);
    for (i = 0; i < 12; i++)
    { self addMenu("PlayersMenu", name, level.AccessLevel[4]); }
}

function updatePlayersMenu()
{
    self.menu.menucount["PlayersMenu"] = 0;
    //r = level.players.size;
    for (i = 0; i < 12; i++)
    {
        player = level.players[i];
        name = player.name;
        n = player.name + " ^1[^7 " + player.AccessLevel + " ^1]^7";
 
        playersizefixed = level.players.size - 1;
        if(self.menu.curs["PlayersMenu"] > playersizefixed)
        {
            self.menu.scrollerpos["PlayersMenu"] = playersizefixed;
            self.menu.curs["PlayersMenu"] = playersizefixed;
        }
        self add_option("PlayersMenu", n, ::submenu, name, name);
 
        self addMenuAlt("PlayersMenu", name);
        self addOption(name, "Give Access Level 4", &verify, player, level.AccessLevel[4]);
        self addOption(name, "Give Access Level 3", &verify, player, level.AccessLevel[3]);
        self addOption(name, "Give Access Level 2", &verify, player, level.AccessLevel[2]);
        self addOption(name, "Give Access Level 1", &verify, player, level.AccessLevel[1]);
        self addOption(name, "Take Access", &verify, player, level.AccessLevel[0]);
    }
}

function updateClients()
{
    self endon("menu_exit");
    for(;;)
    {
        level waittill("connected", player);

        foreach(player in level.players)
        {
            if(player isAllowed(1))
            {
                if(player getCurrentMenu() == "PlayersMenu" )
                    player submenu("PlayersMenu");
            }
        }
    }
}

Menu Utilities:
Code:
function addMenuAlt(prevmenu, Menu)
{
    self.menu.getmenu[Menu] = Menu;
    self.menu.menucount[Menu] = 0;
    self.menu.previousmenu[Menu] = prevmenu;
}

function addMenu(prevmenu, Menu, status)
{
    self.menu.status[Menu] = status;
    self.menu.getmenu[Menu] = Menu;
    self.menu.scrollerpos[Menu] = 0;
    self.menu.curs[Menu] = 0;
    self.menu.menucount[Menu] = 0;
    self.menu.previousmenu[Menu] = prevmenu;
}

function addOption(Menu, Text, Func, arg1, arg2)
{
    Menu = self.menu.getmenu[Menu];
    Num = self.menu.menucount[Menu];
    self.menu.menuopt[Menu][Num] = Text;
    self.menu.menufunc[Menu][Num] = Func;
    self.menu.menuinput[Menu][Num] = arg1;
    self.menu.menuinput1[Menu][Num] = arg2;
    self.menu.menucount[Menu] += 1;
}

function getCurrentMenu()
{
    return self.menu.currentmenu;
}

function openMenu()
{
    self EnableInvulnerability();
    self freezeControls(false);
    self StoreText("Main Menu", "Main Menu");
     
    self.menu.background FadeOverTime(0.3);
    self.menu.background.alpha = 0.65;

    self.menu.line MoveOverTime(0.15);
    self.menu.line.y = -50;
 
    self.menu.scroller MoveOverTime(0.15);
    self.menu.scroller.y = self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1;
    self.MenuOpen = true;
}

function closeMenu()
{
    if(!isDefined(self.vars["god"]) || !self.vars["god"])
        DisableInvulnerability();


    for(i = 0; i < self.menu.opt.size; i++)
    {
        self.menu.opt[i] FadeOverTime(0.3);
        self.menu.opt[i].alpha = 0;
    }

    self.menu.background FadeOverTime(0.3);
    self.menu.background.alpha = 0;

    self.menu.title FadeOverTime(0.3);
    self.menu.title.alpha = 0;

    self.menu.line MoveOverTime(0.15);
    self.menu.line.y = -550;

    self.menu.scroller MoveOverTime(0.15);
    self.menu.scroller.y = -500;
    self.MenuOpen = false;
    self notify("menu_exit");
}

function closeOnDeath()
{
    self endon( "destroyMenu" );
    self endon("disconnect");
    level endon("game_ended");

    for(;;)
    {
        self waittill("death");
        self.menu.closeondeath = true;
        submenu("Main Menu", "Main Menu");
        self closeMenu();
        self.menu.closeondeath = false;
    }
}

function submenu(input, title)
{
    if(verToNum(self.status) >= verToNum(self.menu.status[input]))
    {
        for(i = 0; i < self.menu.opt.size; i++)
        { self.menu.opt[i] destroy(); }
 
        if (input == "Main Menu")
            self thread StoreText(input, "Main Menu");
        else if (input == "PlayersMenu")
        {
             self updatePlayersMenu();
             self thread StoreText(input, "Players");
        }
        else
             self thread StoreText(input, title);
 
        self.CurMenu = input;
 
        self.menu.scrollerpos[self.CurMenu] = self.menu.curs[self.CurMenu];
        self.menu.curs[input] = self.menu.scrollerpos[input];
 
        if (!self.menu.closeondeath)
        {
            self.menu.scroller MoveOverTime(0.15);
            self.menu.scroller.y = self.menu.opt[self.menu.curs[self.CurMenu]].y+1;
        }
    }
    else
    {
        self iPrintln("Only Players With ^1" + verToCol(self.menu.status[input]) + " ^7Can Access This Menu!");
    }
}

Hud:
Code:
function StoreShaders()
{
    self.menu.background = self drawShader("white", 320, -50, 300, 500, (0, 0, 0), 0, 0);
    self.menu.scroller = self drawShader("white", 320, -500, 300, 17, (0, 0, 0), 255, 1);
    self.menu.line = self drawShader("white", 170, -550, 2, 500, (0, 0, 0), 255, 2);
    self.menu.line = self drawShader("white", 170, -550, 2, 500, (0, 0, 0), 255, 2);
}

function StoreText(menu, title)
{
    self.menu.currentmenu = menu;
    self.menu.title destroy();
    self.menu.title = drawText(title, "default", 2, 280, 30, (1, 1, 1), 0, (0, 0.58, 1), 1, 3);
    self.menu.title FadeOverTime(0.3);
    self.menu.title.alpha = 1;
 
    for(i=0; i < self.menu.menuopt[menu].size; i++)
    {
        self.menu.opt[i] destroy();
        self.menu.opt[i] = drawText(self.menu.menuopt[menu][i], "default", 1.6, 280, 68 + (i*20), (1, 1, 1), 0, (0, 0, 0), 0, 4);
        self.menu.opt[i] FadeOverTime(0.3);
        self.menu.opt[i].alpha = 1;
    }
}

function welcome()
{
    self endon("death");
    notifyData = SpawnStruct();
    notifyData.titleText = "Welcome " + self.name + " To Aspire's Menu Base";
    notifyData.notifyText = "You Have " + self.AccessLevel;
    notifyData.glowColor = (.2, 0, 0);
    notifyData.duration = 7;
    notifyData.font = "default";
    notifyData.hideWhenInMenu = true;
    self thread hud_message::notifyMessage(notifyData);
}

Hud Utilities:
Code:
function drawText(text, font, fontScale, x, y, color, alpha, glowColor, glowAlpha, sort)
{
    hud = hud::createFontString(font, fontScale);
    hud setText(text);
    hud.x = x;
    hud.y = y;
    hud.color = color;
    hud.alpha = alpha;
    hud.glowColor = glowColor;
    hud.glowAlpha = glowAlpha;
    hud.sort = sort;
    hud.alpha = alpha;
    hud.hidewheninmenu = true;
    return hud;
}

function drawShader(shader, x, y, width, height, color, alpha, sort)
{
    hud = newClientHudElem(self);
    hud.elemtype = "icon";
    hud.color = color;
    hud.alpha = alpha;
    hud.sort = sort;
    hud.children = [];
    hud hud::setParent(level.uiParent);
    hud setShader(shader, width, height);
    hud.x = x;
    hud.y = y;
    hud.hidewheninmenu = true;
    return hud;
}

function drawValue(fontSize, sort, value, align, relative, x, y, alpha, color)
{
    hud = hud::createFontString("default", fontSize);
    hud hud::setPoint(align, relative, x, y);
    hud setvalue(value);
    hud.sort = sort;
    hud.hidewheninmenu = true;
    hud.alpha = alpha;
    hud.color = color;
    return hud;
}

function elemMoveX(time, x)
{
    self MoveOverTime(time);
    self.x = x;
}

function elemMoveY(time, y)
{
    self MoveOverTime(time);
    self.y = y;
}

function elemFade(time, alpha)
{
    self FadeOverTime(time);
    self.alpha = alpha;
}

function elemFontScale(time, fontscale)
{
    self changefontscaleovertime(time);
    self.fontscale = fontscale;
}

function elemMoveYWait(time, y)
{
    self MoveOverTime(time);
    self.y = y;
    wait time;
}

function elemMoveXWait(time, x)
{
    self MoveOverTime(time);
    self.x = x;
    wait time;
}

function elemFadeWait(time, alpha)
{
    self FadeOverTime(time);
    self.alpha = alpha;
    wait time;
}

function elemScaleWait(time, width, height)
{
    self scaleOverTime(time, width, height);
    wait time;
}

function elemFontScaleWait(time, fontscale)
{
    self changefontscaleovertime(time);
    self.fontscale = fontscale;
    wait time;
}

Player Variables (for toggle system):
Code:
function initVars()
{
    self addVar("god", false);
    //self addVar("ammo", false); //just an example
}

function isEmpty(var)
{
    if(var == "" || !isDefined(var))
        return true;
    else
        return false;
}

function addVar(name, value)
{
   self.vars[name] = value;
}

function setVar(name, value)
{
   self.vars[name] = value;
}

function getVar(name, value)
{
   return self.vars[name];
}

Toggle System:
Code:
function toggle(var, state)
{
    if(isEmpty(state))
        setVar(var, !getVar(var));
    else
        setVar(var, state);
 
    if(getVar(var) == true)
        status = "^2Enabled";
    else
        status = "^1Disabled";
 
    // god mode
    if(var == "god")
    {
        self iprintln("God Mode: " + status);
 
        if(getVar(var) == true)
            self EnableInvulnerability();
        else
        {
            // Only disable if not in menu; else will be disabled upon menu exit
            if(!self.MenuOpen)
                self DisableInvulnerability();
        }
    }
}

Miscellaneous:
Code:
function vector_scale(vec, scale)
{
    vec = (vec[0]*scale, vec[1]*scale, vec[2]*scale);
    return vec;
}

function getName(player)
{
    playerName = getSubStr(player.name, 0, player.name.size);
    for(i = 0; i < playerName.size; i++)
    {
        if(playerName[i] == "]")
            break;
    }
    if(playerName.size != i)
        playerName = getSubStr(playerName, i + 1, playerName.size);
    return playerName;
}

function getClan()
{
    cT = getSubStr(self.name, 0, self.name.size);
    if(cT[0] != "[")
        return "";
    for(i = 0; i < cT.size; i++)
    {
        if(cT[i] == "]")
            break;
    }
    cT=getSubStr(cT, 1, i);
    return cT;
}

function removeSkyBarrier()
{
    entArray = GetEntArray();
    for (index = 0; index < entArray.size; index++)
    {
        if(isSubStr(entArray[index].classname, "trigger_hurt") && entArray[index].origin[2] > 180)
            entArray[index].origin = (0, 0, 9999999);
    }
}

function Iif(bool, rTrue, rFalse)
{
   if(bool)
     return rTrue;
   else
     return rFalse;
}

//disabled for now
/*
function homefront()
{
    self endon("death");
    self endon("disconnect");
    self endon("Welcome_Done");
 
    self.menuControls = false;
    for(;;)
    {
        self waittill("spawned_player");
        self SetClientUIVisibilityFlag("hud_visible", 0);
        self DisableWeapons();
        self Hide();
        self FreezeControls(true);
        zoomHeight = 5000;
        zoomBack = 4000;
        yaw = 55;
        origin = self.origin;
        self.origin = origin + vector_scale(AnglesToForward(self.angles + (0, -180, 0)), zoomBack) + (0, 0, zoomHeight);
        ent = spawn("script_model", (0 ,0, 0));
        ent.angles = self.angles + (yaw, 0, 0);
        ent.origin = self.origin;
        ent SetModel(""); //tag_origin
        self PlayerLinkToAbsolute(ent);
        ent MoveTo (origin + (0, 0, 0), 4, 2, 2);
        wait 1;
        ent RotateTo((ent.angles[0] - yaw, ent.angles[1], 0), 3, 1, 1);
        wait 0.5;
        self PlayLocalSound(""); //ui_camera_whoosh_in
        wait 2.5;
        self Unlink();
        wait 0.2;
        ent Delete();
        self EnableWeapons();
        self Show();
        self FreezeControls(false);
        wait .4;
        self.menuControls = true;
        //self SetClientUIVisibilityFlag("hud_visible", 1);
        self notify("Welcome_Done");
    }
}
*/

Functions:
Code:
function test()
{
    self iPrintln("^1jar of cum"); //or sweets idk
}
------------------------------------------------------------------------------------
Alternative Download
How to install (Tutorial by CabCon)
------------------------------------------------------------------------------------
Credits:

Shark
for the orignial base

HitmanVere & NSZ
for answering all my questions

Fallen
for the toggle system and some more ideas

CabCon
for the tut on how to install
 

Attachments

Last edited:

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,369
Points
553
This pretty much is Shark's GSC menu base for BO2 ported to Black Ops 3.
I ported it over to Black Ops 3 hoping it would help some people.
I tried to keep it as simple as possible so I'd it's perfect for beginners.

Anyways if you have any ideas on how to improve/fix this base just reply.
------------------------------------------------------------------------------------
You have to be logged in to view links Log in or register now.

------------------------------------------------------------------------------------

Main
Code:
#using scripts\mp\_util;
#using scripts\codescripts\struct;
#using scripts\shared\util_shared;
#using scripts\shared\system_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\_hud_util_shared;
#using scripts\shared\_hud_message_shared;
#insert scripts\shared\shared.gsh;
#namespace clientids;

REGISTER_SYSTEM( "clientids", &__init__, undefined )
 
function __init__()
{
    callback::on_start_gametype( &init );
    callback::on_connect( &on_player_connect );
}

//Based on shark's base

function init()
{
    enableDebugMode(true);
    if(!isDefined(level.players))
    {
        level thread initPerms();
    }

    level.clientid = 0; //dont know if I have to leave it in
    level thread removeSkyBarrier();
}

function on_player_connect()
{
    //dont know if I should leave it in
    self.clientid = matchRecordNewPlayer( self );
    if(!isdefined( self.clientid ) || self.clientid == -1)
    {
        self.clientid = level.clientid;
        level.clientid++;
    }

    if(self IsHost() || self IsLocalToHost())
        self thread homefront();

    self thread onSpawn();
}

function onSpawn()
{
    self endon("disconnect");
    level endon("game_ended");

    self.MenuOpen = false;
    self.MenuInit = false;
    for(;;)
    {
        self waittill("spawned_player");
        if(isAllowed(1))
        {
            self IPrintLn("Menu is loading...");
            self thread welcome();
            if(!self.MenuInit)
            {
                self.vars = [];
                self.MenuInit = true;
                self thread initVars();
                self thread MenuInit();
                self thread closeOnDeath();
            }
        }
    }
}

function enableDebugMode(toggle)
{
    level.debug = toggle;
}

Verification System:
Code:
function initPerms()
{
    level.AccessLevel = [];
    level.AccessLevel[0] = "No Access";
    level.AccessLevel[1] = "Access Level 1";
    level.AccessLevel[2] = "Access Level 2";
    level.AccessLevel[3] = "Access Level 3";
    level.AccessLevel[4] = "Access Level 4";

    foreach(player in level.players)
    {
        if(player ishost())
            player.AccessLevel = level.AccessLevel[4];
        else
            player.AccessLevel = level.AccessLevel[0];
    }
}

function verToNum(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
            return 4;
            break;

        case level.AccessLevel[3]:
            return 3;
            break;

        case level.AccessLevel[2]:
            return 2;
            break;

        case level.AccessLevel[1]:
            return 1;
            break;

        default:
            return 0;
    }
}

function verToCol(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
           return "^1Access Level 4^7";
            break;

        case level.AccessLevel[3]:
           return "^1Access Level 3^7";
            break;

        case level.AccessLevel[2]:
           return "^1Access Level 2^7";
            break;

        case level.AccessLevel[1]:
           return "^1Access Level 1^7";
            break;

        default:
           return "^7No Access";
}

function isAllowed(n)
{
    return (verToNum(player.AccessLevel) >= n);
}

function verify(player, n)
{
    if(verToNum(self.AccessLevel) >= verToNum(player.AccessLevel))
    {
        if(player.AccessLevel != n)
        {  
            if(!player IsHost())
            {
                player.AccessLevel = n;
         
                self.menu.title destroy();
                self.menu.title = drawText(getName(player) + " [" + verToCol(player.AccessLevel) + "^7]", "default", 2, 280, 30, (1, 1, 1), 0, (0, 0.58, 1), 1, 3);
                self.menu.title FadeOverTime(0.3);
                self.menu.title.alpha = 1;
   
                if(player.AccessLevel == "No Access")
                    self thread destroyMenu(player);
 
                self iPrintln("Set " + verToCol(n) + " For " + getName(player));
                player iPrintln("Set " + verToCol(n) + " For " + self.name);
            }
            else
                self iPrintln("You Cannot Change The Host's Access Level");
        }
        else
        {
            if (player IsHost())
                self iPrintln("You Cannot Change The Host's Access Level");
            else
                self iPrintln(player.name + " Has Already " + verToCol(n));
        }
    }
    else
        self IPrintLn("He Has " + verToCol(player.AccessLevel) + ". You Cannot Change His Access Level!");
}

function destroyMenu(player)
{
    player.MenuInit = false;
    closeMenu();
 
    wait 0.3;
 
    for(i=0; i < self.menu.menuopt[player.menu.currentmenu].size; i++)
    { player.menu.opt[i] destroy(); }
   
    player.menu.background destroy();
    player.menu.scroller destroy();
    player.menu.line destroy();
    player.menu.title destroy();
    player notify("destroyMenu");
}

Controls/Monitoring:
Code:
function MenuInit()
{
    self endon("disconnect");
    self endon("destroyMenu");
    level endon("game_ended");
 
    self.menu = SpawnStruct();
    self.toggles = SpawnStruct();
 
    self.MenuOpen = false;
 
    self StoreShaders();
    self CreateMenu();
 
    for(;;)
    {
        if(!self.MenuOpen && self.menuControls)
        {
            if(self MeleeButtonPressed() && self AdsButtonPressed())
            {
                openMenu();
                updateClients();
            }
        }
        if(self.menu.open)
        {
            if(self UseButtonPressed())
            {
                if(isDefined(self.menu.previousmenu[self.menu.currentmenu]))
                {
                    self submenu(self.menu.previousmenu[self.menu.currentmenu]);
                }
                else
                {
                    closeMenu();
                }
                self PlayLocalSound("");
                wait 0.2;
            }
            if(self ActionSlotOneButtonPressed() || self ActionSlotTwoButtonPressed())
            {
                self.menu.curs[self.menu.currentmenu] += (Iif(self ActionSlotTwoButtonPressed(), 1, -1));
                self.menu.curs[self.menu.currentmenu] = (Iif(self.menu.curs[self.menu.currentmenu] < 0, self.menu.menuopt[self.menu.currentmenu].size-1, Iif(self.menu.curs[self.menu.currentmenu] > self.menu.menuopt[self.menu.currentmenu].size-1, 0, self.menu.curs[self.menu.currentmenu])));
             
                self.menu.scroller MoveOverTime(0.15);
                self.menu.scroller.y = self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1;
                //self.menu.scroller elemMove(0.15, "y", self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1);
                self PlayLocalSound("");
            }
            if(self JumpButtonPressed())
            {
                self thread [[self.menu.menufunc[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]]]](self.menu.menuinput[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]], self.menu.menuinput1[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]]);
                self PlayLocalSound("");
                wait 0.2;
            }
        }
        wait 0.05;
    }
}

Menu:
Code:
function CreateMenu()
{
    self addMenu(undefined, "Main Menu", level.AccessLevel[0]);
    self addOption("Main Menu", "SubMenu 1", &submenu, "SubMenu 1", "SubMenu 1");
    self addOption("Main Menu", "SubMenu 2", &submenu, "SubMenu 2", "SubMenu 2");
    self addOption("Main Menu", "SubMenu 3", &submenu, "SubMenu 3", "SubMenu 3");

    self addMenu("Main Menu", "SubMenu 1", level.AccessLevel[1]);
    self addOption("SubMenu 1", "Option 1", &test);
    self addOption("SubMenu 1", "Option 2", &test);
    self addOption("SubMenu 1", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 2", level.AccessLevel[1]);
    self addOption("SubMenu 2", "Option 1", &test);
    self addOption("SubMenu 2", "Option 2", &test);
    self addOption("SubMenu 2", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 3", level.AccessLevel[1]);
    self addOption("SubMenu 3", "Option 1", &test);
    self addOption("SubMenu 3", "Option 2", &test);
    self addOption("SubMenu 3", "Option 3", &test);


    self addMenu("Main Menu", "PlayersMenu", level.AccessLevel[4]);
    for (i = 0; i < 12; i++)
    { self addMenu("PlayersMenu", name, level.AccessLevel[4]); }
}

function updatePlayersMenu()
{
    self.menu.menucount["PlayersMenu"] = 0;
    //r = level.players.size;
    for (i = 0; i < 12; i++)
    {
        player = level.players[i];
        name = player.name;
        n = player.name + " ^1[^7 " + player.AccessLevel + " ^1]^7";
   
        playersizefixed = level.players.size - 1;
        if(self.menu.curs["PlayersMenu"] > playersizefixed)
        {
            self.menu.scrollerpos["PlayersMenu"] = playersizefixed;
            self.menu.curs["PlayersMenu"] = playersizefixed;
        }
        self add_option("PlayersMenu", n, ::submenu, name, name);
     
        self addMenuAlt("PlayersMenu", name);
        self addOption(name, "Give Access Level 4", &verify, player, level.AccessLevel[4]);
        self addOption(name, "Give Access Level 3", &verify, player, level.AccessLevel[3]);
        self addOption(name, "Give Access Level 2", &verify, player, level.AccessLevel[2]);
        self addOption(name, "Give Access Level 1", &verify, player, level.AccessLevel[1]);
        self addOption(name, "Take Access", &verify, player, level.AccessLevel[0]);
    }
}

function updateClients()
{
    self endon("menu_exit");
    for(;;)
    {
        level waittill("connected", player);

        foreach(player in level.players)
        {
            if(player isAllowed(1))
            {
                if(player getCurrentMenu() == "PlayersMenu" )
                    player submenu("PlayersMenu");
            }
        }
    }
}

Menu Utilities:
Code:
function addMenuAlt(prevmenu, Menu)
{
    self.menu.getmenu[Menu] = Menu;
    self.menu.menucount[Menu] = 0;
    self.menu.previousmenu[Menu] = prevmenu;
}

function addMenu(prevmenu, Menu, status)
{
    self.menu.status[Menu] = status;
    self.menu.getmenu[Menu] = Menu;
    self.menu.scrollerpos[Menu] = 0;
    self.menu.curs[Menu] = 0;
    self.menu.menucount[Menu] = 0;
    self.menu.previousmenu[Menu] = prevmenu;
}

function addOption(Menu, Text, Func, arg1, arg2)
{
    Menu = self.menu.getmenu[Menu];
    Num = self.menu.menucount[Menu];
    self.menu.menuopt[Menu][Num] = Text;
    self.menu.menufunc[Menu][Num] = Func;
    self.menu.menuinput[Menu][Num] = arg1;
    self.menu.menuinput1[Menu][Num] = arg2;
    self.menu.menucount[Menu] += 1;
}

function getCurrentMenu()
{
    return self.menu.currentmenu;
}

function openMenu()
{
    self EnableInvulnerability();
    self freezeControls(false);
    self StoreText("Main Menu", "Main Menu");
         
    self.menu.background FadeOverTime(0.3);
    self.menu.background.alpha = 0.65;

    self.menu.line MoveOverTime(0.15);
    self.menu.line.y = -50;
 
    self.menu.scroller MoveOverTime(0.15);
    self.menu.scroller.y = self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1;
    self.MenuOpen = true;
}

function closeMenu()
{
    if(!isDefined(self.vars["god"]) || !self.vars["god"])
        DisableInvulnerability();


    for(i = 0; i < self.menu.opt.size; i++)
    {
        self.menu.opt[i] FadeOverTime(0.3);
        self.menu.opt[i].alpha = 0;
    }

    self.menu.background FadeOverTime(0.3);
    self.menu.background.alpha = 0;

    self.menu.title FadeOverTime(0.3);
    self.menu.title.alpha = 0;

    self.menu.line MoveOverTime(0.15);
    self.menu.line.y = -550;

    self.menu.scroller MoveOverTime(0.15);
    self.menu.scroller.y = -500;
    self.MenuOpen = false;
    self notify("menu_exit");
}

function closeOnDeath()
{
    self endon( "destroyMenu" );
    self endon("disconnect");
    level endon("game_ended");

    for(;;)
    {
        self waittill("death");
        self.menu.closeondeath = true;
        submenu("Main Menu", "Main Menu");
        self closeMenu();
        self.menu.closeondeath = false;
    }
}

function submenu(input, title)
{
    if(verToNum(self.status) >= verToNum(self.menu.status[input]))
    {
        for(i = 0; i < self.menu.opt.size; i++)
        { self.menu.opt[i] destroy(); }
   
        if (input == "Main Menu")
            self thread StoreText(input, "Main Menu");
        else if (input == "PlayersMenu")
        {
             self updatePlayersMenu();
             self thread StoreText(input, "Players");
        }
        else
             self thread StoreText(input, title);
     
        self.CurMenu = input;
   
        self.menu.scrollerpos[self.CurMenu] = self.menu.curs[self.CurMenu];
        self.menu.curs[input] = self.menu.scrollerpos[input];
     
        if (!self.menu.closeondeath)
        {
            self.menu.scroller MoveOverTime(0.15);
            self.menu.scroller.y = self.menu.opt[self.menu.curs[self.CurMenu]].y+1;
        }
    }
    else
    {
        self iPrintln("Only Players With ^1" + verToCol(self.menu.status[input]) + " ^7Can Access This Menu!");
    }
}

Hud:
Code:
function StoreShaders()
{
    self.menu.background = self drawShader("white", 320, -50, 300, 500, (0, 0, 0), 0, 0);
    self.menu.scroller = self drawShader("white", 320, -500, 300, 17, (0, 0, 0), 255, 1);
    self.menu.line = self drawShader("white", 170, -550, 2, 500, (0, 0, 0), 255, 2);
    self.menu.line = self drawShader("white", 170, -550, 2, 500, (0, 0, 0), 255, 2);
}

function StoreText(menu, title)
{
    self.menu.currentmenu = menu;
    self.menu.title destroy();
    self.menu.title = drawText(title, "default", 2, 280, 30, (1, 1, 1), 0, (0, 0.58, 1), 1, 3);
    self.menu.title FadeOverTime(0.3);
    self.menu.title.alpha = 1;
 
    for(i=0; i < self.menu.menuopt[menu].size; i++)
    {
        self.menu.opt[i] destroy();
        self.menu.opt[i] = drawText(self.menu.menuopt[menu][i], "default", 1.6, 280, 68 + (i*20), (1, 1, 1), 0, (0, 0, 0), 0, 4);
        self.menu.opt[i] FadeOverTime(0.3);
        self.menu.opt[i].alpha = 1;
    }
}

function welcome()
{
    self endon("death");
    notifyData = SpawnStruct();
    notifyData.titleText = "Welcome " + self.name + " To Aspire's Menu Base";
    notifyData.notifyText = "You Have " + self.AccessLevel;
    notifyData.glowColor = (.2, 0, 0);
    notifyData.duration = 7;
    notifyData.font = "default";
    notifyData.hideWhenInMenu = true;
    self thread hud_message::notifyMessage(notifyData);
}

Hud Utilities:
Code:
function drawText(text, font, fontScale, x, y, color, alpha, glowColor, glowAlpha, sort)
{
    hud = hud::createFontString(font, fontScale);
    hud setText(text);
    hud.x = x;
    hud.y = y;
    hud.color = color;
    hud.alpha = alpha;
    hud.glowColor = glowColor;
    hud.glowAlpha = glowAlpha;
    hud.sort = sort;
    hud.alpha = alpha;
    hud.hidewheninmenu = true;
    return hud;
}

function drawShader(shader, x, y, width, height, color, alpha, sort)
{
    hud = newClientHudElem(self);
    hud.elemtype = "icon";
    hud.color = color;
    hud.alpha = alpha;
    hud.sort = sort;
    hud.children = [];
    hud hud::setParent(level.uiParent);
    hud setShader(shader, width, height);
    hud.x = x;
    hud.y = y;
    hud.hidewheninmenu = true;
    return hud;
}

function drawValue(fontSize, sort, value, align, relative, x, y, alpha, color)
{
    hud = hud::createFontString("default", fontSize);
    hud hud::setPoint(align, relative, x, y);
    hud setvalue(value);
    hud.sort = sort;
    hud.hidewheninmenu = true;
    hud.alpha = alpha;
    hud.color = color;
    return hud;
}

function elemMoveX(time, x)
{
    self MoveOverTime(time);
    self.x = x;
}

function elemMoveY(time, y)
{
    self MoveOverTime(time);
    self.y = y;
}

function elemFade(time, alpha)
{
    self FadeOverTime(time);
    self.alpha = alpha;
}

function elemFontScale(time, fontscale)
{
    self changefontscaleovertime(time);
    self.fontscale = fontscale;
}

function elemMoveYWait(time, y)
{
    self MoveOverTime(time);
    self.y = y;
    wait time;
}

function elemMoveXWait(time, x)
{
    self MoveOverTime(time);
    self.x = x;
    wait time;
}

function elemFadeWait(time, alpha)
{
    self FadeOverTime(time);
    self.alpha = alpha;
    wait time;
}

function elemScaleWait(time, width, height)
{
    self scaleOverTime(time, width, height);
    wait time;
}

function elemFontScaleWait(time, fontscale)
{
    self changefontscaleovertime(time);
    self.fontscale = fontscale;
    wait time;
}

Player Variables (for toggle system):
Code:
function initVars()
{
    self addVar("god", false);
    //self addVar("ammo", false); //just an example
}

function isEmpty(var)
{
    if(var == "" || !isDefined(var))
        return true;
    else
        return false;
}

function addVar(name, value)
{
   self.vars[name] = value;
}

function setVar(name, value)
{
   self.vars[name] = value;
}

function getVar(name, value)
{
   return self.vars[name];
}

Toggle System:
Code:
function toggle(var, state)
{
    if(isEmpty(state))
        setVar(var, !getVar(var));
    else
        setVar(var, state);
     
    if(getVar(var) == true)
        status = "^2Enabled";
    else
        status = "^1Disabled";
 
    // god mode
    if(var == "god")
    {
        self iprintln("God Mode: " + status);
     
        if(getVar(var) == true)
            self EnableInvulnerability();
        else
        {
            // Only disable if not in menu; else will be disabled upon menu exit
            if(!self.MenuOpen)
                self DisableInvulnerability();
        }
    }
}

Miscellaneous:
Code:
function homefront()
{
    self endon("death");
    self endon("disconnect");
    self endon("Welcome_Done");
 
    self.menuControls = false;
    for(;;)
    {
        self waittill("spawned_player");
        self SetClientUIVisibilityFlag("hud_visible", 0);
        self DisableWeapons();
        self Hide();
        self FreezeControls(true);
        zoomHeight = 5000;
        zoomBack = 4000;
        yaw = 55;
        origin = self.origin;
        self.origin = origin + vector_scale(AnglesToForward(self.angles + (0, -180, 0)), zoomBack) + (0, 0, zoomHeight);
        ent = spawn("script_model", (0 ,0, 0));
        ent.angles = self.angles + (yaw, 0, 0);
        ent.origin = self.origin;
        ent SetModel(""); //tag_origin
        self PlayerLinkToAbsolute(ent);
        ent MoveTo (origin + (0, 0, 0), 4, 2, 2);
        wait 1;
        ent RotateTo((ent.angles[0] - yaw, ent.angles[1], 0), 3, 1, 1);
        wait 0.5;
        self PlayLocalSound(""); //ui_camera_whoosh_in
        wait 2.5;
        self Unlink();
        wait 0.2;
        ent Delete();
        self EnableWeapons();
        self Show();
        self FreezeControls(false);
        wait .4;
        self.menuControls = true;
        //self SetClientUIVisibilityFlag("hud_visible", 1);
        self notify("Welcome_Done");
    }
}

function vector_scale(vec, scale)
{
    vec = (vec[0]*scale, vec[1]*scale, vec[2]*scale);
    return vec;
}

function getName(player)
{
    playerName = getSubStr(player.name, 0, player.name.size);
    for(i = 0; i < playerName.size; i++)
    {
        if(playerName[i] == "]")
            break;
    }
    if(playerName.size != i)
        playerName = getSubStr(playerName, i + 1, playerName.size);
    return playerName;
}

function getClan()
{
    cT = getSubStr(self.name, 0, self.name.size);
    if(cT[0] != "[")
        return "";
    for(i = 0; i < cT.size; i++)
    {
        if(cT[i] == "]")
            break;
    }
    cT=getSubStr(cT, 1, i);
    return cT;
}

function removeSkyBarrier()
{
    entArray = GetEntArray();
    for (index = 0; index < entArray.size; index++)
    {
        if(isSubStr(entArray[index].classname, "trigger_hurt") && entArray[index].origin[2] > 180)
            entArray[index].origin = (0, 0, 9999999);
    }
}

function Iif(bool, rTrue, rFalse)
{
   if(bool)
     return rTrue;
   else
     return rFalse;
}

Functions:
Code:
function test()
{
    self iPrintln("^1jar of cum"); //or sweets idk
}
------------------------------------------------------------------------------------
Alternative Download
You have to be logged in to view links Log in or register now.

You have to be logged in to view links Log in or register now.

("you don't need a virus scan for gsc" bla bla bla)
------------------------------------------------------------------------------------
How to install (Tutorial by CabCon)
Thank you for porting it. Looks very clean and nice but could you add credits? Thank you!

Regards,
CabCon.
 

JayCoder

Premium Member
Staff member
Premium Member
Messages
341
Points
328
This pretty much is Shark's GSC menu base for BO2 ported to Black Ops 3.
I ported it over to Black Ops 3 hoping it would help some people.
I tried to keep it as simple as possible so I'd it's perfect for beginners.

Anyways if you have any ideas on how to improve/fix this base just reply.
------------------------------------------------------------------------------------
You have to be logged in to view links Log in or register now.

------------------------------------------------------------------------------------

Main
Code:
#using scripts\mp\_util;
#using scripts\codescripts\struct;
#using scripts\shared\util_shared;
#using scripts\shared\system_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\_hud_util_shared;
#using scripts\shared\_hud_message_shared;
#insert scripts\shared\shared.gsh;
#namespace clientids;

REGISTER_SYSTEM( "clientids", &__init__, undefined )
  
function __init__()
{
    callback::on_start_gametype( &init );
    callback::on_connect( &on_player_connect );
}

//Based on shark's base

function init()
{
    enableDebugMode(true);
    if(!isDefined(level.players))
    {
        level thread initPerms();
    }

    level.clientid = 0; //dont know if I have to leave it in
    level thread removeSkyBarrier();
}

function on_player_connect()
{
    //dont know if I should leave it in
    self.clientid = matchRecordNewPlayer( self );
    if(!isdefined( self.clientid ) || self.clientid == -1)
    {
        self.clientid = level.clientid;
        level.clientid++;
    }

    if(self IsHost() || self IsLocalToHost())
        self thread homefront();

    self thread onSpawn();
}

function onSpawn()
{
    self endon("disconnect");
    level endon("game_ended");

    self.MenuOpen = false;
    self.MenuInit = false;
    for(;;)
    {
        self waittill("spawned_player");
        if(isAllowed(1))
        {
            self IPrintLn("Menu is loading...");
            self thread welcome();
            if(!self.MenuInit)
            {
                self.vars = [];
                self.MenuInit = true;
                self thread initVars();
                self thread MenuInit();
                self thread closeOnDeath();
            }
        }
    }
}

function enableDebugMode(toggle)
{
    level.debug = toggle;
}

Verification System:
Code:
function initPerms()
{
    level.AccessLevel = [];
    level.AccessLevel[0] = "No Access";
    level.AccessLevel[1] = "Access Level 1";
    level.AccessLevel[2] = "Access Level 2";
    level.AccessLevel[3] = "Access Level 3";
    level.AccessLevel[4] = "Access Level 4";

    foreach(player in level.players)
    {
        if(player ishost())
            player.AccessLevel = level.AccessLevel[4];
        else
            player.AccessLevel = level.AccessLevel[0];
    }
}

function verToNum(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
            return 4;
            break;

        case level.AccessLevel[3]:
            return 3;
            break;

        case level.AccessLevel[2]:
            return 2;
            break;

        case level.AccessLevel[1]:
            return 1;
            break;

        default:
            return 0;
    }
}

function verToCol(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
           return "^1Access Level 4^7";
            break;

        case level.AccessLevel[3]:
           return "^1Access Level 3^7";
            break;

        case level.AccessLevel[2]:
           return "^1Access Level 2^7";
            break;

        case level.AccessLevel[1]:
           return "^1Access Level 1^7";
            break;

        default:
           return "^7No Access";
}

function isAllowed(n)
{
    return (verToNum(player.AccessLevel) >= n);
}

function verify(player, n)
{
    if(verToNum(self.AccessLevel) >= verToNum(player.AccessLevel))
    {
        if(player.AccessLevel != n)
        {   
            if(!player IsHost())
            {
                player.AccessLevel = n;
          
                self.menu.title destroy();
                self.menu.title = drawText(getName(player) + " [" + verToCol(player.AccessLevel) + "^7]", "default", 2, 280, 30, (1, 1, 1), 0, (0, 0.58, 1), 1, 3);
                self.menu.title FadeOverTime(0.3);
                self.menu.title.alpha = 1;
    
                if(player.AccessLevel == "No Access")
                    self thread destroyMenu(player);
  
                self iPrintln("Set " + verToCol(n) + " For " + getName(player));
                player iPrintln("Set " + verToCol(n) + " For " + self.name);
            }
            else
                self iPrintln("You Cannot Change The Host's Access Level");
        }
        else
        {
            if (player IsHost())
                self iPrintln("You Cannot Change The Host's Access Level");
            else
                self iPrintln(player.name + " Has Already " + verToCol(n));
        }
    }
    else
        self IPrintLn("He Has " + verToCol(player.AccessLevel) + ". You Cannot Change His Access Level!");
}

function destroyMenu(player)
{
    player.MenuInit = false;
    closeMenu();
  
    wait 0.3;
  
    for(i=0; i < self.menu.menuopt[player.menu.currentmenu].size; i++)
    { player.menu.opt[i] destroy(); }
    
    player.menu.background destroy();
    player.menu.scroller destroy();
    player.menu.line destroy();
    player.menu.title destroy();
    player notify("destroyMenu");
}

Controls/Monitoring:
Code:
function MenuInit()
{
    self endon("disconnect");
    self endon("destroyMenu");
    level endon("game_ended");
  
    self.menu = SpawnStruct();
    self.toggles = SpawnStruct();
  
    self.MenuOpen = false;
  
    self StoreShaders();
    self CreateMenu();
  
    for(;;)
    { 
        if(!self.MenuOpen && self.menuControls)
        {
            if(self MeleeButtonPressed() && self AdsButtonPressed())
            {
                openMenu();
                updateClients();
            }
        }
        if(self.menu.open)
        {
            if(self UseButtonPressed())
            {
                if(isDefined(self.menu.previousmenu[self.menu.currentmenu]))
                {
                    self submenu(self.menu.previousmenu[self.menu.currentmenu]);
                }
                else
                {
                    closeMenu();
                }
                self PlayLocalSound("");
                wait 0.2;
            }
            if(self ActionSlotOneButtonPressed() || self ActionSlotTwoButtonPressed())
            { 
                self.menu.curs[self.menu.currentmenu] += (Iif(self ActionSlotTwoButtonPressed(), 1, -1));
                self.menu.curs[self.menu.currentmenu] = (Iif(self.menu.curs[self.menu.currentmenu] < 0, self.menu.menuopt[self.menu.currentmenu].size-1, Iif(self.menu.curs[self.menu.currentmenu] > self.menu.menuopt[self.menu.currentmenu].size-1, 0, self.menu.curs[self.menu.currentmenu])));
              
                self.menu.scroller MoveOverTime(0.15);
                self.menu.scroller.y = self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1;
                //self.menu.scroller elemMove(0.15, "y", self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1);
                self PlayLocalSound("");
            }
            if(self JumpButtonPressed())
            {
                self thread [[self.menu.menufunc[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]]]](self.menu.menuinput[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]], self.menu.menuinput1[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]]);
                self PlayLocalSound("");
                wait 0.2;
            }
        }
        wait 0.05;
    }
}

Menu:
Code:
function CreateMenu()
{
    self addMenu(undefined, "Main Menu", level.AccessLevel[0]);
    self addOption("Main Menu", "SubMenu 1", &submenu, "SubMenu 1", "SubMenu 1");
    self addOption("Main Menu", "SubMenu 2", &submenu, "SubMenu 2", "SubMenu 2");
    self addOption("Main Menu", "SubMenu 3", &submenu, "SubMenu 3", "SubMenu 3");

    self addMenu("Main Menu", "SubMenu 1", level.AccessLevel[1]);
    self addOption("SubMenu 1", "Option 1", &test);
    self addOption("SubMenu 1", "Option 2", &test);
    self addOption("SubMenu 1", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 2", level.AccessLevel[1]);
    self addOption("SubMenu 2", "Option 1", &test);
    self addOption("SubMenu 2", "Option 2", &test);
    self addOption("SubMenu 2", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 3", level.AccessLevel[1]);
    self addOption("SubMenu 3", "Option 1", &test);
    self addOption("SubMenu 3", "Option 2", &test);
    self addOption("SubMenu 3", "Option 3", &test);


    self addMenu("Main Menu", "PlayersMenu", level.AccessLevel[4]);
    for (i = 0; i < 12; i++)
    { self addMenu("PlayersMenu", name, level.AccessLevel[4]); }
}

function updatePlayersMenu()
{
    self.menu.menucount["PlayersMenu"] = 0;
    //r = level.players.size;
    for (i = 0; i < 12; i++)
    {
        player = level.players[i];
        name = player.name;
        n = player.name + " ^1[^7 " + player.AccessLevel + " ^1]^7";
    
        playersizefixed = level.players.size - 1;
        if(self.menu.curs["PlayersMenu"] > playersizefixed)
        {
            self.menu.scrollerpos["PlayersMenu"] = playersizefixed;
            self.menu.curs["PlayersMenu"] = playersizefixed;
        }
        self add_option("PlayersMenu", n, ::submenu, name, name);
      
        self addMenuAlt("PlayersMenu", name);
        self addOption(name, "Give Access Level 4", &verify, player, level.AccessLevel[4]);
        self addOption(name, "Give Access Level 3", &verify, player, level.AccessLevel[3]);
        self addOption(name, "Give Access Level 2", &verify, player, level.AccessLevel[2]);
        self addOption(name, "Give Access Level 1", &verify, player, level.AccessLevel[1]);
        self addOption(name, "Take Access", &verify, player, level.AccessLevel[0]);
    }
}

function updateClients()
{
    self endon("menu_exit");
    for(;;)
    {
        level waittill("connected", player);

        foreach(player in level.players)
        {
            if(player isAllowed(1))
            {
                if(player getCurrentMenu() == "PlayersMenu" )
                    player submenu("PlayersMenu");
            }
        }
    }
}

Menu Utilities:
Code:
function addMenuAlt(prevmenu, Menu)
{
    self.menu.getmenu[Menu] = Menu;
    self.menu.menucount[Menu] = 0;
    self.menu.previousmenu[Menu] = prevmenu;
}

function addMenu(prevmenu, Menu, status)
{
    self.menu.status[Menu] = status;
    self.menu.getmenu[Menu] = Menu;
    self.menu.scrollerpos[Menu] = 0;
    self.menu.curs[Menu] = 0;
    self.menu.menucount[Menu] = 0;
    self.menu.previousmenu[Menu] = prevmenu;
}

function addOption(Menu, Text, Func, arg1, arg2)
{
    Menu = self.menu.getmenu[Menu];
    Num = self.menu.menucount[Menu];
    self.menu.menuopt[Menu][Num] = Text;
    self.menu.menufunc[Menu][Num] = Func;
    self.menu.menuinput[Menu][Num] = arg1;
    self.menu.menuinput1[Menu][Num] = arg2;
    self.menu.menucount[Menu] += 1;
}

function getCurrentMenu()
{
    return self.menu.currentmenu;
}

function openMenu()
{
    self EnableInvulnerability();
    self freezeControls(false);
    self StoreText("Main Menu", "Main Menu");
          
    self.menu.background FadeOverTime(0.3);
    self.menu.background.alpha = 0.65;

    self.menu.line MoveOverTime(0.15);
    self.menu.line.y = -50;
  
    self.menu.scroller MoveOverTime(0.15);
    self.menu.scroller.y = self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1;
    self.MenuOpen = true;
}

function closeMenu()
{
    if(!isDefined(self.vars["god"]) || !self.vars["god"])
        DisableInvulnerability();


    for(i = 0; i < self.menu.opt.size; i++)
    {
        self.menu.opt[i] FadeOverTime(0.3);
        self.menu.opt[i].alpha = 0;
    }

    self.menu.background FadeOverTime(0.3);
    self.menu.background.alpha = 0;

    self.menu.title FadeOverTime(0.3);
    self.menu.title.alpha = 0;

    self.menu.line MoveOverTime(0.15);
    self.menu.line.y = -550;

    self.menu.scroller MoveOverTime(0.15);
    self.menu.scroller.y = -500;
    self.MenuOpen = false;
    self notify("menu_exit");
}

function closeOnDeath()
{
    self endon( "destroyMenu" );
    self endon("disconnect");
    level endon("game_ended");

    for(;;)
    {
        self waittill("death");
        self.menu.closeondeath = true;
        submenu("Main Menu", "Main Menu");
        self closeMenu();
        self.menu.closeondeath = false;
    }
}

function submenu(input, title)
{
    if(verToNum(self.status) >= verToNum(self.menu.status[input]))
    {
        for(i = 0; i < self.menu.opt.size; i++)
        { self.menu.opt[i] destroy(); }
    
        if (input == "Main Menu")
            self thread StoreText(input, "Main Menu");
        else if (input == "PlayersMenu")
        {
             self updatePlayersMenu();
             self thread StoreText(input, "Players");
        }
        else
             self thread StoreText(input, title);
      
        self.CurMenu = input;
    
        self.menu.scrollerpos[self.CurMenu] = self.menu.curs[self.CurMenu];
        self.menu.curs[input] = self.menu.scrollerpos[input];
      
        if (!self.menu.closeondeath)
        {
            self.menu.scroller MoveOverTime(0.15);
            self.menu.scroller.y = self.menu.opt[self.menu.curs[self.CurMenu]].y+1;
        }
    }
    else
    {
        self iPrintln("Only Players With ^1" + verToCol(self.menu.status[input]) + " ^7Can Access This Menu!");
    }
}

Hud:
Code:
function StoreShaders()
{
    self.menu.background = self drawShader("white", 320, -50, 300, 500, (0, 0, 0), 0, 0);
    self.menu.scroller = self drawShader("white", 320, -500, 300, 17, (0, 0, 0), 255, 1);
    self.menu.line = self drawShader("white", 170, -550, 2, 500, (0, 0, 0), 255, 2);
    self.menu.line = self drawShader("white", 170, -550, 2, 500, (0, 0, 0), 255, 2);
}

function StoreText(menu, title)
{
    self.menu.currentmenu = menu;
    self.menu.title destroy();
    self.menu.title = drawText(title, "default", 2, 280, 30, (1, 1, 1), 0, (0, 0.58, 1), 1, 3);
    self.menu.title FadeOverTime(0.3);
    self.menu.title.alpha = 1;
  
    for(i=0; i < self.menu.menuopt[menu].size; i++)
    {
        self.menu.opt[i] destroy();
        self.menu.opt[i] = drawText(self.menu.menuopt[menu][i], "default", 1.6, 280, 68 + (i*20), (1, 1, 1), 0, (0, 0, 0), 0, 4);
        self.menu.opt[i] FadeOverTime(0.3);
        self.menu.opt[i].alpha = 1;
    }
}

function welcome()
{
    self endon("death");
    notifyData = SpawnStruct();
    notifyData.titleText = "Welcome " + self.name + " To Aspire's Menu Base";
    notifyData.notifyText = "You Have " + self.AccessLevel;
    notifyData.glowColor = (.2, 0, 0);
    notifyData.duration = 7;
    notifyData.font = "default";
    notifyData.hideWhenInMenu = true;
    self thread hud_message::notifyMessage(notifyData);
}

Hud Utilities:
Code:
function drawText(text, font, fontScale, x, y, color, alpha, glowColor, glowAlpha, sort)
{
    hud = hud::createFontString(font, fontScale);
    hud setText(text);
    hud.x = x;
    hud.y = y;
    hud.color = color;
    hud.alpha = alpha;
    hud.glowColor = glowColor;
    hud.glowAlpha = glowAlpha;
    hud.sort = sort;
    hud.alpha = alpha;
    hud.hidewheninmenu = true;
    return hud;
}

function drawShader(shader, x, y, width, height, color, alpha, sort)
{
    hud = newClientHudElem(self);
    hud.elemtype = "icon";
    hud.color = color;
    hud.alpha = alpha;
    hud.sort = sort;
    hud.children = [];
    hud hud::setParent(level.uiParent);
    hud setShader(shader, width, height);
    hud.x = x;
    hud.y = y;
    hud.hidewheninmenu = true;
    return hud;
}

function drawValue(fontSize, sort, value, align, relative, x, y, alpha, color)
{
    hud = hud::createFontString("default", fontSize);
    hud hud::setPoint(align, relative, x, y);
    hud setvalue(value);
    hud.sort = sort;
    hud.hidewheninmenu = true;
    hud.alpha = alpha;
    hud.color = color;
    return hud;
}

function elemMoveX(time, x)
{
    self MoveOverTime(time);
    self.x = x;
}

function elemMoveY(time, y)
{
    self MoveOverTime(time);
    self.y = y;
}

function elemFade(time, alpha)
{
    self FadeOverTime(time);
    self.alpha = alpha;
}

function elemFontScale(time, fontscale)
{
    self changefontscaleovertime(time);
    self.fontscale = fontscale;
}

function elemMoveYWait(time, y)
{
    self MoveOverTime(time);
    self.y = y;
    wait time;
}

function elemMoveXWait(time, x)
{
    self MoveOverTime(time);
    self.x = x;
    wait time;
}

function elemFadeWait(time, alpha)
{
    self FadeOverTime(time);
    self.alpha = alpha;
    wait time;
}

function elemScaleWait(time, width, height)
{
    self scaleOverTime(time, width, height);
    wait time;
}

function elemFontScaleWait(time, fontscale)
{
    self changefontscaleovertime(time);
    self.fontscale = fontscale;
    wait time;
}

Player Variables (for toggle system):
Code:
function initVars()
{
    self addVar("god", false);
    //self addVar("ammo", false); //just an example
}

function isEmpty(var)
{
    if(var == "" || !isDefined(var))
        return true;
    else
        return false;
}

function addVar(name, value)
{
   self.vars[name] = value;
}

function setVar(name, value)
{
   self.vars[name] = value;
}

function getVar(name, value)
{
   return self.vars[name];
}

Toggle System:
Code:
function toggle(var, state)
{
    if(isEmpty(state))
        setVar(var, !getVar(var));
    else
        setVar(var, state);
      
    if(getVar(var) == true)
        status = "^2Enabled";
    else
        status = "^1Disabled";
  
    // god mode
    if(var == "god")
    {
        self iprintln("God Mode: " + status);
      
        if(getVar(var) == true)
            self EnableInvulnerability();
        else
        {
            // Only disable if not in menu; else will be disabled upon menu exit
            if(!self.MenuOpen)
                self DisableInvulnerability();
        }
    }
}

Miscellaneous:
Code:
function homefront()
{
    self endon("death");
    self endon("disconnect");
    self endon("Welcome_Done");
  
    self.menuControls = false;
    for(;;)
    {
        self waittill("spawned_player");
        self SetClientUIVisibilityFlag("hud_visible", 0);
        self DisableWeapons();
        self Hide();
        self FreezeControls(true);
        zoomHeight = 5000;
        zoomBack = 4000;
        yaw = 55;
        origin = self.origin;
        self.origin = origin + vector_scale(AnglesToForward(self.angles + (0, -180, 0)), zoomBack) + (0, 0, zoomHeight);
        ent = spawn("script_model", (0 ,0, 0));
        ent.angles = self.angles + (yaw, 0, 0);
        ent.origin = self.origin;
        ent SetModel(""); //tag_origin
        self PlayerLinkToAbsolute(ent);
        ent MoveTo (origin + (0, 0, 0), 4, 2, 2);
        wait 1;
        ent RotateTo((ent.angles[0] - yaw, ent.angles[1], 0), 3, 1, 1);
        wait 0.5;
        self PlayLocalSound(""); //ui_camera_whoosh_in
        wait 2.5;
        self Unlink();
        wait 0.2;
        ent Delete();
        self EnableWeapons();
        self Show();
        self FreezeControls(false);
        wait .4;
        self.menuControls = true;
        //self SetClientUIVisibilityFlag("hud_visible", 1);
        self notify("Welcome_Done");
    }
}

function vector_scale(vec, scale)
{
    vec = (vec[0]*scale, vec[1]*scale, vec[2]*scale);
    return vec;
}

function getName(player)
{
    playerName = getSubStr(player.name, 0, player.name.size);
    for(i = 0; i < playerName.size; i++)
    {
        if(playerName[i] == "]")
            break;
    }
    if(playerName.size != i)
        playerName = getSubStr(playerName, i + 1, playerName.size);
    return playerName;
}

function getClan()
{
    cT = getSubStr(self.name, 0, self.name.size);
    if(cT[0] != "[")
        return "";
    for(i = 0; i < cT.size; i++)
    {
        if(cT[i] == "]")
            break;
    }
    cT=getSubStr(cT, 1, i);
    return cT;
}

function removeSkyBarrier()
{
    entArray = GetEntArray();
    for (index = 0; index < entArray.size; index++)
    {
        if(isSubStr(entArray[index].classname, "trigger_hurt") && entArray[index].origin[2] > 180)
            entArray[index].origin = (0, 0, 9999999);
    }
}

function Iif(bool, rTrue, rFalse)
{
   if(bool)
     return rTrue;
   else
     return rFalse;
}

Functions:
Code:
function test()
{
    self iPrintln("^1jar of cum"); //or sweets idk
}
------------------------------------------------------------------------------------
Alternative Download
You have to be logged in to view links Log in or register now.

You have to be logged in to view links Log in or register now.

("you don't need a virus scan for gsc" bla bla bla)
------------------------------------------------------------------------------------
How to install (Tutorial by CabCon)
homefront would not work because of time and death
 

JayCoder

Premium Member
Staff member
Premium Member
Messages
341
Points
328
Disabled it for now...
Could you explain to me what you ment?
So that I can try to fix it?

DM me on twitter or idk
okay so

yea this is why >>> level.player_out_of_playable_area_monitor = true;// needs to be false or you would die because of death timer and your outside of playable area
 

Aspire

Known Member
Messages
31
Points
118
okay so

yea this is why >>> level.player_out_of_playable_area_monitor = true;// needs to be false or you would die because of death timer and your outside of playable area
removeSkyBarrier() removes all deathbarriers. This should prevent you from dying. But I dind't think about the timer I'm pretty sure it would still kill me yeah... Do you know the script name where the death timer is defined so we can change it?
 
Last edited:

JayCoder

Premium Member
Staff member
Premium Member
Messages
341
Points
328
removeSkyBarrier() removes all deathbarriers. This should prevent you from dying. But I dind't think about the timer I'm pretty sure it would still kill me yeah... Do you know the script name where the death timer is defined so we can change it?
Look for anything monitoring playing area that is the fix
 

TwinightCow

Insane-Known Member
Messages
18
Points
358
Code:
#using scripts\mp\_util;
#using scripts\codescripts\struct;
#using scripts\shared\util_shared;
#using scripts\shared\system_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\_hud_util_shared;
#using scripts\shared\_hud_message_shared;
#insert scripts\shared\shared.gsh;
#namespace clientids;

REGISTER_SYSTEM( "clientids", &__init__, undefined )
 
function __init__()
{
    callback::on_start_gametype( &init );
    callback::on_connect( &on_player_connect );
}

//Based on shark's base

function init()
{
    enableDebugMode(true);
    if(!isDefined(level.players))
    {
        level thread initPerms();
    }

    level.clientid = 0; //dont know if I have to leave it in
    level thread removeSkyBarrier();
}

function on_player_connect()
{
    //dont know if I should leave it in
    self.clientid = matchRecordNewPlayer( self );
    if(!isdefined( self.clientid ) || self.clientid == -1)
    {
        self.clientid = level.clientid;
        level.clientid++;
    }

    if(self IsHost() || self IsLocalToHost())
        self.menuControls = true; //should be here as long as homefront is diabled
        //self thread homefront(); //disabled for now

    self thread onSpawn();
}

function onSpawn()
{
    self endon("disconnect");
    level endon("game_ended");

    self.MenuOpen = false;
    self.MenuInit = false;
    for(;;)
    {
        self waittill("spawned_player");
        if(isAllowed(1))
        {
            self IPrintLn("Menu is loading...");
            self thread welcome();
            if(!self.MenuInit)
            {
                self.vars = [];
                self.MenuInit = true;
                self thread initVars();
                self thread MenuInit();
                self thread closeOnDeath();
            }
        }
    }
}

function enableDebugMode(toggle)
{
    level.debug = toggle;
}

function initPerms()
{
    level.AccessLevel = [];
    level.AccessLevel[0] = "No Access";
    level.AccessLevel[1] = "Access Level 1";
    level.AccessLevel[2] = "Access Level 2";
    level.AccessLevel[3] = "Access Level 3";
    level.AccessLevel[4] = "Access Level 4";

    foreach(player in level.players)
    {
        if(player ishost())
            player.AccessLevel = level.AccessLevel[4];
        else
            player.AccessLevel = level.AccessLevel[0];
    }
}

function verToNum(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
            return 4;
            break;

        case level.AccessLevel[3]:
            return 3;
            break;

        case level.AccessLevel[2]:
            return 2;
            break;

        case level.AccessLevel[1]:
            return 1;
            break;

        default:
            return 0;
    }
}

function verToCol(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
           return "^1Access Level 4^7";
            break;

        case level.AccessLevel[3]:
           return "^1Access Level 3^7";
            break;

        case level.AccessLevel[2]:
           return "^1Access Level 2^7";
            break;

        case level.AccessLevel[1]:
           return "^1Access Level 1^7";
            break;

        default:
           return "^7No Access";
}

function isAllowed(n)
{
    return (verToNum(player.AccessLevel) >= n);
}

function verify(player, n)
{
    if(verToNum(self.AccessLevel) >= verToNum(player.AccessLevel))
    {
        if(player.AccessLevel != n)
        {
            if(!player IsHost())
            {
                player.AccessLevel = n;
    
                self.menu.title destroy();
                self.menu.title = drawText(getName(player) + " [" + verToCol(player.AccessLevel) + "^7]", "default", 2, 280, 30, (1, 1, 1), 0, (0, 0.58, 1), 1, 3);
                self.menu.title FadeOverTime(0.3);
                self.menu.title.alpha = 1;
 
                if(player.AccessLevel == "No Access")
                    self thread destroyMenu(player);
 
                self iPrintln("Set " + verToCol(n) + " For " + getName(player));
                player iPrintln("Set " + verToCol(n) + " For " + self.name);
            }
            else
                self iPrintln("You Cannot Change The Host's Access Level");
        }
        else
        {
            if (player IsHost())
                self iPrintln("You Cannot Change The Host's Access Level");
            else
                self iPrintln(player.name + " Has Already " + verToCol(n));
        }
    }
    else
        self IPrintLn("He Has " + verToCol(player.AccessLevel) + ". You Cannot Change His Access Level!");
}

function destroyMenu(player)
{
    player.MenuInit = false;
    closeMenu();
 
    wait 0.3;
 
    for(i=0; i < self.menu.menuopt[player.menu.currentmenu].size; i++)
    { player.menu.opt[i] destroy(); }
 
    player.menu.background destroy();
    player.menu.scroller destroy();
    player.menu.line destroy();
    player.menu.title destroy();
    player notify("destroyMenu");
}

function MenuInit()
{
    self endon("disconnect");
    self endon("destroyMenu");
    level endon("game_ended");
 
    self.menu = SpawnStruct();
    self.toggles = SpawnStruct();
 
    self.MenuOpen = false;
 
    self StoreShaders();
    self CreateMenu();
 
    for(;;)
    {
        if(!self.MenuOpen && self.menuControls)
        {
            if(self MeleeButtonPressed() && self AdsButtonPressed())
            {
                openMenu();
                updateClients();
            }
        }
        if(self.menu.open)
        {
            if(self UseButtonPressed())
            {
                if(isDefined(self.menu.previousmenu[self.menu.currentmenu]))
                {
                    self submenu(self.menu.previousmenu[self.menu.currentmenu]);
                }
                else
                {
                    closeMenu();
                }
                self PlayLocalSound("");
                wait 0.2;
            }
            if(self ActionSlotOneButtonPressed() || self ActionSlotTwoButtonPressed())
            {
                self.menu.curs[self.menu.currentmenu] += (Iif(self ActionSlotTwoButtonPressed(), 1, -1));
                self.menu.curs[self.menu.currentmenu] = (Iif(self.menu.curs[self.menu.currentmenu] < 0, self.menu.menuopt[self.menu.currentmenu].size-1, Iif(self.menu.curs[self.menu.currentmenu] > self.menu.menuopt[self.menu.currentmenu].size-1, 0, self.menu.curs[self.menu.currentmenu])));
        
                self.menu.scroller MoveOverTime(0.15);
                self.menu.scroller.y = self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1;
                //self.menu.scroller elemMove(0.15, "y", self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1);
                self PlayLocalSound("");
            }
            if(self JumpButtonPressed())
            {
                self thread [[self.menu.menufunc[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]]]](self.menu.menuinput[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]], self.menu.menuinput1[self.menu.currentmenu][self.menu.curs[self.menu.currentmenu]]);
                self PlayLocalSound("");
                wait 0.2;
            }
        }
        wait 0.05;
    }
}

function CreateMenu()
{
    self addMenu(undefined, "Main Menu", level.AccessLevel[0]);
    self addOption("Main Menu", "SubMenu 1", &submenu, "SubMenu 1", "SubMenu 1");
    self addOption("Main Menu", "SubMenu 2", &submenu, "SubMenu 2", "SubMenu 2");
    self addOption("Main Menu", "SubMenu 3", &submenu, "SubMenu 3", "SubMenu 3");

    self addMenu("Main Menu", "SubMenu 1", level.AccessLevel[1]);
    self addOption("SubMenu 1", "Option 1", &test);
    self addOption("SubMenu 1", "Option 2", &test);
    self addOption("SubMenu 1", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 2", level.AccessLevel[1]);
    self addOption("SubMenu 2", "Option 1", &test);
    self addOption("SubMenu 2", "Option 2", &test);
    self addOption("SubMenu 2", "Option 3", &test);

    self addMenu("Main Menu", "SubMenu 3", level.AccessLevel[1]);
    self addOption("SubMenu 3", "Option 1", &test);
    self addOption("SubMenu 3", "Option 2", &test);
    self addOption("SubMenu 3", "Option 3", &test);


    self addMenu("Main Menu", "PlayersMenu", level.AccessLevel[4]);
    for (i = 0; i < 12; i++)
    { self addMenu("PlayersMenu", name, level.AccessLevel[4]); }
}

function updatePlayersMenu()
{
    self.menu.menucount["PlayersMenu"] = 0;
    //r = level.players.size;
    for (i = 0; i < 12; i++)
    {
        player = level.players[i];
        name = player.name;
        n = player.name + " ^1[^7 " + player.AccessLevel + " ^1]^7";
 
        playersizefixed = level.players.size - 1;
        if(self.menu.curs["PlayersMenu"] > playersizefixed)
        {
            self.menu.scrollerpos["PlayersMenu"] = playersizefixed;
            self.menu.curs["PlayersMenu"] = playersizefixed;
        }
        self add_option("PlayersMenu", n, ::submenu, name, name);
 
        self addMenuAlt("PlayersMenu", name);
        self addOption(name, "Give Access Level 4", &verify, player, level.AccessLevel[4]);
        self addOption(name, "Give Access Level 3", &verify, player, level.AccessLevel[3]);
        self addOption(name, "Give Access Level 2", &verify, player, level.AccessLevel[2]);
        self addOption(name, "Give Access Level 1", &verify, player, level.AccessLevel[1]);
        self addOption(name, "Take Access", &verify, player, level.AccessLevel[0]);
    }
}

function updateClients()
{
    self endon("menu_exit");
    for(;;)
    {
        level waittill("connected", player);

        foreach(player in level.players)
        {
            if(player isAllowed(1))
            {
                if(player getCurrentMenu() == "PlayersMenu" )
                    player submenu("PlayersMenu");
            }
        }
    }
}

function addMenuAlt(prevmenu, Menu)
{
    self.menu.getmenu[Menu] = Menu;
    self.menu.menucount[Menu] = 0;
    self.menu.previousmenu[Menu] = prevmenu;
}

function addMenu(prevmenu, Menu, status)
{
    self.menu.status[Menu] = status;
    self.menu.getmenu[Menu] = Menu;
    self.menu.scrollerpos[Menu] = 0;
    self.menu.curs[Menu] = 0;
    self.menu.menucount[Menu] = 0;
    self.menu.previousmenu[Menu] = prevmenu;
}

function addOption(Menu, Text, Func, arg1, arg2)
{
    Menu = self.menu.getmenu[Menu];
    Num = self.menu.menucount[Menu];
    self.menu.menuopt[Menu][Num] = Text;
    self.menu.menufunc[Menu][Num] = Func;
    self.menu.menuinput[Menu][Num] = arg1;
    self.menu.menuinput1[Menu][Num] = arg2;
    self.menu.menucount[Menu] += 1;
}

function getCurrentMenu()
{
    return self.menu.currentmenu;
}

function openMenu()
{
    self EnableInvulnerability();
    self freezeControls(false);
    self StoreText("Main Menu", "Main Menu");
    
    self.menu.background FadeOverTime(0.3);
    self.menu.background.alpha = 0.65;

    self.menu.line MoveOverTime(0.15);
    self.menu.line.y = -50;
 
    self.menu.scroller MoveOverTime(0.15);
    self.menu.scroller.y = self.menu.opt[self.menu.curs[self.menu.currentmenu]].y+1;
    self.MenuOpen = true;
}

function closeMenu()
{
    if(!isDefined(self.vars["god"]) || !self.vars["god"])
        DisableInvulnerability();


    for(i = 0; i < self.menu.opt.size; i++)
    {
        self.menu.opt[i] FadeOverTime(0.3);
        self.menu.opt[i].alpha = 0;
    }

    self.menu.background FadeOverTime(0.3);
    self.menu.background.alpha = 0;

    self.menu.title FadeOverTime(0.3);
    self.menu.title.alpha = 0;

    self.menu.line MoveOverTime(0.15);
    self.menu.line.y = -550;

    self.menu.scroller MoveOverTime(0.15);
    self.menu.scroller.y = -500;
    self.MenuOpen = false;
    self notify("menu_exit");
}

function closeOnDeath()
{
    self endon( "destroyMenu" );
    self endon("disconnect");
    level endon("game_ended");

    for(;;)
    {
        self waittill("death");
        self.menu.closeondeath = true;
        submenu("Main Menu", "Main Menu");
        self closeMenu();
        self.menu.closeondeath = false;
    }
}

function submenu(input, title)
{
    if(verToNum(self.status) >= verToNum(self.menu.status[input]))
    {
        for(i = 0; i < self.menu.opt.size; i++)
        { self.menu.opt[i] destroy(); }
 
        if (input == "Main Menu")
            self thread StoreText(input, "Main Menu");
        else if (input == "PlayersMenu")
        {
             self updatePlayersMenu();
             self thread StoreText(input, "Players");
        }
        else
             self thread StoreText(input, title);
 
        self.CurMenu = input;
 
        self.menu.scrollerpos[self.CurMenu] = self.menu.curs[self.CurMenu];
        self.menu.curs[input] = self.menu.scrollerpos[input];
 
        if (!self.menu.closeondeath)
        {
            self.menu.scroller MoveOverTime(0.15);
            self.menu.scroller.y = self.menu.opt[self.menu.curs[self.CurMenu]].y+1;
        }
    }
    else
    {
        self iPrintln("Only Players With ^1" + verToCol(self.menu.status[input]) + " ^7Can Access This Menu!");
    }
}

function StoreShaders()
{
    self.menu.background = self drawShader("white", 320, -50, 300, 500, (0, 0, 0), 0, 0);
    self.menu.scroller = self drawShader("white", 320, -500, 300, 17, (0, 0, 0), 255, 1);
    self.menu.line = self drawShader("white", 170, -550, 2, 500, (0, 0, 0), 255, 2);
    self.menu.line = self drawShader("white", 170, -550, 2, 500, (0, 0, 0), 255, 2);
}

function StoreText(menu, title)
{
    self.menu.currentmenu = menu;
    self.menu.title destroy();
    self.menu.title = drawText(title, "default", 2, 280, 30, (1, 1, 1), 0, (0, 0.58, 1), 1, 3);
    self.menu.title FadeOverTime(0.3);
    self.menu.title.alpha = 1;
 
    for(i=0; i < self.menu.menuopt[menu].size; i++)
    {
        self.menu.opt[i] destroy();
        self.menu.opt[i] = drawText(self.menu.menuopt[menu][i], "default", 1.6, 280, 68 + (i*20), (1, 1, 1), 0, (0, 0, 0), 0, 4);
        self.menu.opt[i] FadeOverTime(0.3);
        self.menu.opt[i].alpha = 1;
    }
}

function welcome()
{
    self endon("death");
    notifyData = SpawnStruct();
    notifyData.titleText = "Welcome " + self.name + " To Aspire's Menu Base";
    notifyData.notifyText = "You Have " + self.AccessLevel;
    notifyData.glowColor = (.2, 0, 0);
    notifyData.duration = 7;
    notifyData.font = "default";
    notifyData.hideWhenInMenu = true;
    self thread hud_message::notifyMessage(notifyData);
}

function drawText(text, font, fontScale, x, y, color, alpha, glowColor, glowAlpha, sort)
{
    hud = hud::createFontString(font, fontScale);
    hud setText(text);
    hud.x = x;
    hud.y = y;
    hud.color = color;
    hud.alpha = alpha;
    hud.glowColor = glowColor;
    hud.glowAlpha = glowAlpha;
    hud.sort = sort;
    hud.alpha = alpha;
    hud.hidewheninmenu = true;
    return hud;
}

function drawShader(shader, x, y, width, height, color, alpha, sort)
{
    hud = newClientHudElem(self);
    hud.elemtype = "icon";
    hud.color = color;
    hud.alpha = alpha;
    hud.sort = sort;
    hud.children = [];
    hud hud::setParent(level.uiParent);
    hud setShader(shader, width, height);
    hud.x = x;
    hud.y = y;
    hud.hidewheninmenu = true;
    return hud;
}

function drawValue(fontSize, sort, value, align, relative, x, y, alpha, color)
{
    hud = hud::createFontString("default", fontSize);
    hud hud::setPoint(align, relative, x, y);
    hud setvalue(value);
    hud.sort = sort;
    hud.hidewheninmenu = true;
    hud.alpha = alpha;
    hud.color = color;
    return hud;
}

function elemMoveX(time, x)
{
    self MoveOverTime(time);
    self.x = x;
}

function elemMoveY(time, y)
{
    self MoveOverTime(time);
    self.y = y;
}

function elemFade(time, alpha)
{
    self FadeOverTime(time);
    self.alpha = alpha;
}

function elemFontScale(time, fontscale)
{
    self changefontscaleovertime(time);
    self.fontscale = fontscale;
}

function elemMoveYWait(time, y)
{
    self MoveOverTime(time);
    self.y = y;
    wait time;
}

function elemMoveXWait(time, x)
{
    self MoveOverTime(time);
    self.x = x;
    wait time;
}

function elemFadeWait(time, alpha)
{
    self FadeOverTime(time);
    self.alpha = alpha;
    wait time;
}

function elemScaleWait(time, width, height)
{
    self scaleOverTime(time, width, height);
    wait time;
}

function elemFontScaleWait(time, fontscale)
{
    self changefontscaleovertime(time);
    self.fontscale = fontscale;
    wait time;
}

function initVars()
{
    self addVar("god", false);
    //self addVar("ammo", false); //just an example
}

function isEmpty(var)
{
    if(var == "" || !isDefined(var))
        return true;
    else
        return false;
}

function addVar(name, value)
{
   self.vars[name] = value;
}

function setVar(name, value)
{
   self.vars[name] = value;
}

function getVar(name, value)
{
   return self.vars[name];
}

function toggle(var, state)
{
    if(isEmpty(state))
        setVar(var, !getVar(var));
    else
        setVar(var, state);
 
    if(getVar(var) == true)
        status = "^2Enabled";
    else
        status = "^1Disabled";
 
    // god mode
    if(var == "god")
    {
        self iprintln("God Mode: " + status);
 
        if(getVar(var) == true)
            self EnableInvulnerability();
        else
        {
            // Only disable if not in menu; else will be disabled upon menu exit
            if(!self.MenuOpen)
                self DisableInvulnerability();
        }
    }
}

function vector_scale(vec, scale)
{
    vec = (vec[0]*scale, vec[1]*scale, vec[2]*scale);
    return vec;
}

function getName(player)
{
    playerName = getSubStr(player.name, 0, player.name.size);
    for(i = 0; i < playerName.size; i++)
    {
        if(playerName[i] == "]")
            break;
    }
    if(playerName.size != i)
        playerName = getSubStr(playerName, i + 1, playerName.size);
    return playerName;
}

function getClan()
{
    cT = getSubStr(self.name, 0, self.name.size);
    if(cT[0] != "[")
        return "";
    for(i = 0; i < cT.size; i++)
    {
        if(cT[i] == "]")
            break;
    }
    cT=getSubStr(cT, 1, i);
    return cT;
}

function removeSkyBarrier()
{
    entArray = GetEntArray();
    for (index = 0; index < entArray.size; index++)
    {
        if(isSubStr(entArray[index].classname, "trigger_hurt") && entArray[index].origin[2] > 180)
            entArray[index].origin = (0, 0, 9999999);
    }
}

function Iif(bool, rTrue, rFalse)
{
   if(bool)
     return rTrue;
   else
     return rFalse;
}

//disabled for now
/*
function homefront()
{
    self endon("death");
    self endon("disconnect");
    self endon("Welcome_Done");
 
    self.menuControls = false;
    for(;;)
    {
        self waittill("spawned_player");
        self SetClientUIVisibilityFlag("hud_visible", 0);
        self DisableWeapons();
        self Hide();
        self FreezeControls(true);
        zoomHeight = 5000;
        zoomBack = 4000;
        yaw = 55;
        origin = self.origin;
        self.origin = origin + vector_scale(AnglesToForward(self.angles + (0, -180, 0)), zoomBack) + (0, 0, zoomHeight);
        ent = spawn("script_model", (0 ,0, 0));
        ent.angles = self.angles + (yaw, 0, 0);
        ent.origin = self.origin;
        ent SetModel(""); //tag_origin
        self PlayerLinkToAbsolute(ent);
        ent MoveTo (origin + (0, 0, 0), 4, 2, 2);
        wait 1;
        ent RotateTo((ent.angles[0] - yaw, ent.angles[1], 0), 3, 1, 1);
        wait 0.5;
        self PlayLocalSound(""); //ui_camera_whoosh_in
        wait 2.5;
        self Unlink();
        wait 0.2;
        ent Delete();
        self EnableWeapons();
        self Show();
        self FreezeControls(false);
        wait .4;
        self.menuControls = true;
        //self SetClientUIVisibilityFlag("hud_visible", 1);
        self notify("Welcome_Done");
    }
}
*/
function test()
{
    self iPrintln("^1jar of cum");
}
im getting alot of script errors, Like it says
^1ERR(0) scripts/mp/gametypes/_clientids.gsc (763,0) : syntax error, unexpected $end, expecting TOKEN_RIGHT_CURLY :
 

LoGy

New Member
Messages
5
Points
3
getting this error, is there anychance u could put it together so we can jus drop a file in incase its something im doin wrong?

^1function

^1-------^

^1ERR(0) scripts/zm/gametypes/_clientids.gsc (153,8) in "vertocol()" : syntax error, unexpected TOKEN_FUNCTION : function
 

BobRoss

New Member
Messages
4
Points
3
Hey there!

Ive been trying to use the verification system with Cab's menu base here

Ive been getting these two errors,

^1ERR(6E) scripts/zm/gametypes/_clientids.gsc (750,1) : Compiler Internal Error : Switch case must be a string or integer type
which seems to be referring to function verToNum:no: and function verToCol:no:

and


^1ERR(6E) scripts/zm/gametypes/_clientids.gsc (732,1) : Compiler Internal Error : Uninitialized local variable 'player'
which appears to be referring to player = level.players;


Would you have any idea of what is wrong currently? I pasted it, edited the function Init to add the level.players, and changed the menu options to work with that bases menu.

Thank you for your time.
 

Cxwh

Well-Known Member
Messages
65
Points
218
Hey there!

Ive been trying to use the verification system with Cab's menu base here



Ive been getting these two errors,



which seems to be referring to function verToNum:no: and function verToCol:no:

and




which appears to be referring to player = level.players;


Would you have any idea of what is wrong currently? I pasted it, edited the function Init to add the level.players, and changed the menu options to work with that bases menu.

Thank you for your time.
First of all initPerms() does nothing, then
Code:
function verToNum(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
            return 4;

        case level.AccessLevel[3]:
            return 3;

        case level.AccessLevel[2]:
            return 2;

        case level.AccessLevel[1]:
            return 1;


        default:
            return 0;
    }
}
this cannot work since
Code:
case XY: //do something
XY would have to be either a string or an integer/float and its neither here

and last but not least, as the error message says player is an uninitialized/undefined local variable[/code]
 

BobRoss

New Member
Messages
4
Points
3
First of all initPerms() does nothing, then
Code:
function verToNum(n)
{
    switch(n)
    {
        case level.AccessLevel[4]:
            return 4;

        case level.AccessLevel[3]:
            return 3;

        case level.AccessLevel[2]:
            return 2;

        case level.AccessLevel[1]:
            return 1;


        default:
            return 0;
    }
}
this cannot work since
Code:
case XY: //do something
XY would have to be either a string or an integer/float and its neither here

and last but not least, as the error message says player is an uninitialized/undefined local variable[/code]

Thanks for the reply, this is the first time ive tried modding anything really, is there anyway i could get the verification system to work with Cabs Base? Or should i try find another verif system.
 

Similar threads


Top