PnF Menu base

Discussion in 'Call of Duty: Black Ops 2 Scripts' started by vampytwist, Aug 31, 2017.

  1. vampytwist

    vampytwist "Don't you trust me?" Staff Member Premium Member

    497
    479
    278
    Credits:
    7,678
    Bit buggy, was a fairly quick and sloppy port if I'm to be honest but someone out there may find this useful

    [​IMG]


    Code:
    #include maps\mp\_utility;
    #include common_scripts\utility;
    #include maps\mp\gametypes_zm\_hud_util;
    #include maps\mp\gametypes_zm\_hud_message;
    #include maps\_hud_util;
    #include maps\_utility;
    #include animscripts\utility;
    
    
    init()
    {
       level thread onPlayerConnect();
       precacheShader("hint_health");
    }
    
    onPlayerConnect()
    {
    self.pisbucket = true;
       self.assbucket = true;
       self.GodModeIsOn = false;
       level.godtextshow = true;
       level.modmenulobby = false;
       level.rainstarter = true;
       level.Raindeletetime = false;
       level.Small = false;
       level.BigBoy = false;
       level.InOutAction = false;
       level.NotifyTextDelete = false;
       level.The_Forge_Lobby = false;
       level.primaryProgressBarTextX = 0;
       level.primaryProgressBarTextY = 96;
       level.primaryProgressBarFontSize = 1.3;
       level.lobbyTimer = "^1Not Set";
       level.patch = "Physics 'n' Flex v2 edit";
       level.patchCreator = "Mikeeeyy - Edited by Mikeeeyy";
       level.permissions = strTok("Client;Vip;Admin", ";");
       level.additionTrigs = [];
       level.visions = strTok("berserker;ber1_default;ber2;ber2_collapse;ber2_darksubway;ber2_interior;ber2_lightsubway;ber2_smoke_crouch;ber2_smoke_stand;ber3;ber3b;ber3b_2;cheat_bw;cheat_bw_contrast;cheat_bw_invert;cheat_contrast;cheat_invert;cheat_invert_contrast;default_night;flare;fly_dark;fly_light;fly_mid;grayscale;introscreen;kamikaze;default", ";");
       level.visions2 = strTok("laststand;mak;mak_Fire;mpoutro;oki2;oki3_mortar;pel1;pel1a_intro;pel1a_intro2;pel1_battlefield;pel1b;pel1b_caves;revive;see1;see1_fire;see2;sepia;sniper_inside_fire;sniper_wake;sniper_water;vampire_low;vampire_high;zombie_factory;zombie_turned;default", ";");
       level.prestigeBadges = [];
       level.prestigeBadges[0] = "rank_comm1";
       for (m = 1; m <= 11; m++)
           level.prestigeBadges[m] = "rank_prestige" + m;
       level.ranks = strTok("Private;Private II;Private III;Private First Class;Private First Class I;Private First Class II;Corporal;Corporal I;Corporal II;Sergeant;Sergeant I;Sergeant II;Staff Sergeant;Staff Sergeant I;Staff Sergeant II;Staff Sergeant III;Gunnery Sergeant;Gunnery Sergeant I;Gunnery Sergeant II;Gunnery Sergeant III;Master Sergeant;Master Sergeant I;Master Sergeant II;Master Sergeant III;Sergeant Major;Sergeant Major I;Sergeant Major II;Sergeant Major III;2nd Lieutenant;2nd Lieutenant I;2nd Lieutenant II;2nd Lieutenant III;1st Lieutenant;1st Lieutenant I;1st Lieutenant II;1st Lieutenant III;Captain;Captain I;Captain II;Captain III;Major;Major I;Major II;Major III;Lt. Colonel;Lt. Colonel I;Lt. Colonel II;Lt. Colonel III;Colonel;Colonel I;Colonel II;Colonel III;Brigadier General;Brigadier General I;Brigadier General II;Brigadier General III;Major General;Major General I;Major General II;Major General III;Lieutenant General;Lieutenant General I;Lieutenant General II;Lieutenant General III;Commander", ";");
       level.clanTags = strTok("NERD;****;****;****;NUTS;SLAG;PAKI;{@@};SEX;SEXY;FAG;ARSE;IW;@@@@;DICK;****;ASS;NIGR;JTAG;****;TITS;BOOB;PUSY;****;3ARC;CYCL;MOVE;RAIN;CYLN;KRDR;****;....;BLUE;CYAN;GRN;RED;YELW", ";");
       level.menuWait = .4;
       level.hideSeek_timer = 90;
       level.colr = strTok("Black;Red;Green;Yellow;Blue;Cyan;Orange;White", ";");
       level.cols = strTok("^0;^1;^2;^3;^4;^5;^6;^7", ";");
       level.char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
       level.powerUps = strTok("double_points;insta_kill;full_ammo;nuke;carpenter", ";");
       level.powerUpModels = strTok("zombie_x2_icon;zombie_skull;zombie_ammocan;zombie_bomb;zombie_carpenter", ";");
       level.powerUpProper = strTok("Double Points;Insta-Kill;Max Ammo;Nuke;Carpenter", ";");
       level.maniaMax = 10;
       for(;;)
       {
           level waittill("connected", player);
           player thread onPlayerSpawned();
       }
    }
    
    onPlayerSpawned()
    {
       for (i = 1; i < getPlayers().size; i++) {
           getPlayers()[i] thread grantMenu(level.permissions[0]);
           getPlayers()[i] thread lockMenu();
         //  getPlayers()[i] thread naughtyDvars();
       }
       for(;;)
       {
           self waittill("spawned_player");
           if (isDefined(self.playerSpawned))
               continue;
           self.playerSpawned = true;
           self.menusmall = false;
           self.menumedium = true;
           self.menularge = false;
           self.menuexlarge = false;
           self.Menusizing = false;
           self.TOPCENTER = true;
           level.chalk_hud1.foreground = 0;
           level.chalk_hud1.sort = -1000;
           level.chalk_hud2.foreground = 0;
           level.chalk_hud2.sort = -1000;
           level.randyPlayer = getPlayers()[randomInt(getPlayers().size)];
           if (self isHost()) {
               self.Has_The_Menu = true;
               self setPermission(level.permissions[2]);
               self grantMenu(level.permissions[2]);
               self thread unlockMenu();
               buttonConfig = strTok("enter BUTTON_X", " ");
               self thread levelJustStarted();
          }
       }
    }
    
    levelJustStarted() {
       level.justStarted = true;
       wait 7;
       level.justStarted = undefined;
    }
    
    initializeMainMenuOpts() {
       a = "main";
       if (level.gameTypeChosen == "forge")
           self addMenu(a, "Physics 'n' Flex v2 edit", "forge");
       if (level.gameTypeChosen != "forge")
           self addMenu(a, "Physics 'n' Flex v2 edit", undefined);
       self addOpt(a, "Fog Editor", ::newMenu, "FogColor");
       self addOpt(a, "Sun Editor", ::newMenu, "SunColor");
       self addOpt(a, "Weapons Menu", ::newMenu, "weaps");
       self addOpt(a, "Visions", ::newMenu, "vis");
       self addOpt(a, "Music Playlist", ::newMenu, "music");
       self addOpt(a, "Basic Modifications", ::newMenu, "basic");
       self addOpt(a, "Menu Customization", ::newMenu, "cust");
       if (self getPermission() == level.permissions[1] || self getPermission() == level.permissions[2]) {
           self addOpt(a, "Projectiles", ::newMenu, "Projectx");
           self addOpt(a, "Teleport Menu", ::newMenu, "Telep");
           if (getMap() == "nzf")
               self addOpt(a, "Rain Models", ::newMenu, "Rain");
           if (getMap() == "nzp")
               self addOpt(a, "Rain Models", ::newMenu, "Rainp");
           if (getMap() == "nzp" || getMap() == "nza" || getMap() == "nzs" || getMap() == "nzf")
               self addOpt(a, "Model Manipulation", ::newMenu, "models");
           self addOpt(a, "Profile Management", ::newMenu, "prof");
           self addOpt(a, "Vip Modifications", ::newMenu, "vip");
           if (self getPermission() == level.permissions[2]) {
               self addOpt(a, "Zombie Options", ::newMenu, "zomb");
               self addOpt(a, "Dvar Managment", ::newMenu, "dvar");
               if (getMap() == "nzf")
                   self addOpt(a, "Spawnables", ::newMenu, "spawn");
               if (level.The_Forge_Lobby != true)
                   self addOpt(a, "Forge Menu", ::newMenu, "forge");
               self addOpt(a, "Verification Menu", ::newMenu, "veri");
               self addOpt(a, "Administration Menu", ::newMenu, "admin");
               if (!isDefined(level.gameTypeChosen))
                   self addOpt(a, "Gametype", ::newMenu, "gameT");
           }
       }
    
       a = "spawn";
       self addMenu(a, "Spawnables:", "main");
    
       a = "skyTxt";
       self addMenu(a, "Sky Text:", "spawn");
    
       a = "veri";
       self addMenu(a, "Verification Menu:", "main");
       for (e = 0; e < getPlayers().size; e++) {
           who = getPlayers()[e];
           if (e == 0 && self != getPlayers()[e])
               continue;
    
           name = who getName();
           menu1 = a + " " + who getName();
           menu2 = menu1 + " perm";
           menu3 = menu1 + " prest";
           menu4 = menu1 + " Rankzz";
           self addOpt(a, "^7[^2" + who getPermission() + "^7]" + name, ::newMenu, menu1);
    
           f = ::verificationOpts;
           if (self.FxOn == 1)
               self addMenu(menu1, "^2[^7" + who getPermission() + "^2]" + name + "", a);
           if (self.FxOn == 0)
               self addMenu(menu1, "^2[^7" + who getPermission() + "^2]" + name + "'s Options:", a);
           self addOpt(menu1, "Set Permission", ::newMenu, menu2);
           self addOpt(menu1, "Set Prestige", ::newMenu, menu3);
           self addOpt(menu1, "Set Rank", ::newMenu, menu4);
           self addOpt(menu1, "Send to Jail", f, "jail", e);
           if (getMap() == "nzf") {
               self addOpt(menu1, "Send to Other Jail", f, "jail2", e);
               self addOpt(menu1, "Send to Prison", f, "prison", e);
           }
           self addOpt(menu1, "Set Free from Jails/Prison", f, "unJail", e);
           self addOpt(menu1, "Freeze Player", f, "freeze", e);
           self addOpt(menu1, "Un-Freeze Player", f, "unFreeze", e);
           self addOpt(menu1, "Kick Player from Lobby", f, "kick", e);
           if (self == getPlayers()[0]) {
               self addOpt(menu1, "Kick Player to Singleplayer", f, "kickS", e);
               self addOpt(menu1, "Kick Player to Multiplayer", f, "kickM", e);
               self addOpt(menu1, "Kick Player to Dashboard/XMB", f, "dash", e);
           }
           self addOpt(menu1, "Give All Weapons", f, "giveAll", e);
           self addOpt(menu1, "Take All Weapons", f, "takeAll", e);
           self addOpt(menu1, "Summon Player", f, "summon", e);
           self addOpt(menu1, "Teleport To Player", f, "teleportTo", e);
           self addOpt(menu1, "Lock Mod Menu", f, "menuLock", e);
           self addOpt(menu1, "Unlock Mod Menu", f, "menuUnlock", e);
           self addOpt(menu1, "Derank Player", f, "derank", e);
           self addOpt(menu1, "Perma-Ban Player", f, "PermaBan", e);
           self addOpt(menu1, "Kill Player", f, "kill", e);
           self addOpt(menu1, "Revive Player", f, "revive", e);
           self addOpt(menu1, "Unlock Attachments", f, "attach", e);
           self addOpt(menu1, "Unlock Achievements", f, "achieve", e);
           self addOpt(menu1, "Legit Stats", f, "legit", e);
           self addOpt(menu1, "Moderate Stats", f, "moderate", e);
           self addOpt(menu1, "Insane Stats", f, "insane", e);
           self addOpt(menu1, "Respawn", f, "respawn", e);
           self addOpt(menu1, "Infect w/ Sticky Bind Blocks", f, "blockBinds", e);
           if (isDefined(who.menu["misc"]["menuLocked"]))
               self addOpt(menu1, "Give Menu Secretly", f, "secretMenu", e);
           if (self.FxOn == 1)
               self addMenu(menu2, "^2[^7" + who getPermission() + "^2]" + name + "'s", menu1);
           if (self.FxOn == 0)
               self addMenu(menu2, "^2[^7" + who getPermission() + "^2]" + name + "'s Permission:", menu1);
           for (t = 0; t < level.permissions.size; t++)
               self addOpt(menu2, "Set Permission: " + level.permissions[t], f, "veri", e, t);
    
           if (self.FxOn == 1)
               self addMenu(menu3, "^2[^7" + who getPermission() + "^2]" + name + "'s", menu1);
           if (self.FxOn == 0)
               self addMenu(menu3, "^2[^7" + who getPermission() + "^2]" + name + "'s Prestige:", menu1);
           for (t = 0; t < 11 + 1; t++)
               self addOpt(menu3, "Set Prestige: " + t, f, "prest", e, t);
    
           if (self.FxOn == 1)
               self addMenu(menu4, "^2[^7" + who getPermission() + "^2]" + name + "'s", menu1);
           if (self.FxOn == 0)
               self addMenu(menu4, "^2[^7" + who getPermission() + "^2]" + name + "'s Rank:", menu1);
           for (t = 1; t <= 65; t++)
               self addOpt(menu4, "Set Rank: " + t, f, "Rankzz", e, t);
       }
    
       a = "prof";
       self addMenu(a, "Profile Managment:", "main");
       self addOpt(a, "^6* ^7= Must Submit Active Action!");
       self addOpt(a, "Manage: Clantag^6*", ::newMenu, "clan");
    
       a = "forge";
       if (level.gameTypeChosen == "forge")
           self addMenu(a, "Forge Mode:", undefined);
       if (level.gameTypeChosen != "forge")
           self addMenu(a, "Forge Mode:", "main");
    
    }
     verificationOpts(opt, who, input) {
       who = getPlayers()[who];
       name = who getname();
       switch (opt) {
      
          case "null":
        
               break;
       }
    }
     initializeMenuOpts() {
      a = "FogColor";
       self addMenu(a, "Fog Colors:", "main");
    
       a = "FogColor1";
       self addMenu(a, "Fog Colors:", "FogColor");
    
       a = "SunColor";
       self addMenu(a, "Sun Colors:", "main");
       self addOpt(a, "Sun Colors", ::newMenu, "Sunny");
    
       a = "Sunny";
       self addMenu(a, "Sun Colors:", "SunColor");
    
       a = "weaps";
       self addMenu(a, "Weapons Menu:", "main");
      
       a = "vis";
       self addMenu(a, "Visions:", "main");
       self addOpt(a, "^6More Visions", ::newMenu, "vis2");
    
       a = "vis2";
       self addMenu(a, "More Visions:", "vis");
    
       a = "music";
       self addMenu(a, "Music Playlist:", "main");
    
       a = "basic";
       self addMenu(a, "Basic Modifications:", "main");
    
       a = "Perkz";
       self addMenu(a, "Perks Menu:", "basic");
    
       a = "score";
       self addMenu(a, "Score:", "basic");
    
       a = "cust";
       self addMenu(a, "Menu Customization:", "main");
       self addOpt(a, "Background Color", ::newMenu, "backcolor");
       self addOpt(a, "Scroller Color", ::newMenu, "scrollcolor");
       self addOpt(a, "Background Shader", ::newMenu, "custShad_bg");
       self addOpt(a, "Scroller Shader", ::newMenu, "custShad_scroller");
       self addOpt(a, "Background Alpha", ::newMenu, "custAlp_bg");
       self addOpt(a, "Scroller Alpha", ::newMenu, "custAlp_scroller");
       self addOpt(a, "Menu Font Types", ::newMenu, "FontsM");
       self addOpt(a, "Menu Font Colors", ::newMenu, "TextCo");
       self addOpt(a, "Menu Font Sizes", ::newMenu, "TextSize");
       self addOpt(a, "Menu Font Positions", ::newMenu, "Textplace");
       self addOpt(a, "Menu Layout Positions", ::newMenu, "Menuplace");
       self addOpt(a, "Edit Menu Sizes", ::newMenu, "MenuSize");
       self addOpt(a, "Edit Menu Sounds", ::newMenu, "MenuSounds");
       self addOpt(a, "^6*^7Menu Themes^6*", ::newMenu, "MenuThemes");
    
       a = "backcolor";
       self addMenu(a, "Backround Color:", "cust");
       self addOpt(a, "Backround Colors", ::newMenu, "backc");
    
       a = "scrollcolor";
       self addMenu(a, "Scroller Color:", "cust");
    
       a = "backc";
       self addMenu(a, "Backround Colors:", "backcolor");
    
       a = "scrollc";
       self addMenu(a, "Scroller Colors:", "scrollcolor");
    
       a = strTok("bg;scroller", ";");
    
       a = "FontsM";
       self addMenu(a, "Menu Font Types:", "cust");
       self addOpt(a, "Title Font Type", ::newMenu, "Tfonts");
       self addOpt(a, "Text Font Type", ::newMenu, "Mofonts");
    
       a = "Tfonts";
       self addMenu(a, "Title Font Type:", "FontsM");
    
       a = "Mofonts";
       self addMenu(a, "Text Font Type:", "FontsM");
    
       a = "TextCo";
       self addMenu(a, "Menu Font Colors:", "cust");
       self addOpt(a, "Title Color", ::newMenu, "TitleCo");
       self addOpt(a, "Text Color", ::newMenu, "MenuCo");
    
       a = "TitleCo";
       self addMenu(a, "Title Color:", "TextCo");
    
       a = "MenuCo";
       self addMenu(a, "Text Color:", "TextCo");
    
       a = "TextSize";
       self addMenu(a, "Menu Font Sizes:", "cust");
       self addOpt(a, "Title Size", ::newMenu, "TitleSi");
       self addOpt(a, "Text Size", ::newMenu, "TextSi");
    
       a = "TitleSi";
       self addMenu(a, "Title Size:", "TextSize");
    
       a = "TextSi";
       self addMenu(a, "Text Size:", "TextSize");
    
       a = "Textplace";
       self addMenu(a, "Menu Font Positions:", "cust");
    
       a = "Menuplace";
       self addMenu(a, "Menu Layout Positions:", "cust");
    
       a = "MenuSize";
       self addMenu(a, "Edit Menu Sizes:", "cust");
    
       a = "MenuSounds";
       self addMenu(a, "Edit Menu Sounds:", "cust");
       self addOpt(a, "Open Menu Sound", ::newMenu, "SoundOpen");
       self addOpt(a, "Close Menu Sound", ::newMenu, "SoundClose");
       self addOpt(a, "Scroller Menu Sound", ::newMenu, "SoundScrol");
    
       a = "SoundOpen";
       self addMenu(a, "Open Menu Sound:", "MenuSounds");
    
       a = "SoundClose";
       self addMenu(a, "Close Menu Sound:", "MenuSounds");
       self addMenu(a, "Close Menu Sound:", "MenuSounds");
    
       a = "SoundScrol";
       self addMenu(a, "Scroller Menu Sound:", "MenuSounds");
    
       a = "MenuThemes";
       self addMenu(a, "Menu Themes:", "cust");
    
       a = "Projectx";
       self addMenu(a, "Projectiles Menu:", "main");
    
       a = "EQmenu";
       self addMenu(a, "Equipment Menu:", "Projectx");
    
       a = "GRmenu";
       self addMenu(a, "Grenade Fx Menu:", "Projectx");
    
       a = "GRmenup";
       self addMenu(a, "Grenade Fx Menu:", "Projectx");
    
       a = "GunMods";
       self addMenu(a, "Gun Mods:", "Projectx");
    
       a = "bulFx";
       self addMenu(a, "Bullet Fx:", "Projectx");
    
       a = "Telep";
       self addMenu(a, "Teleport Menu:", "main");
    
       a = "Rain";
       self addMenu(a, "Rain Models:", "main");
    
       a = "Rainp";
       self addMenu(a, "Rain Models:", "main");
    
       a = "models";
       self addMenu(a, "Model Manipulation:", "main");
    
       a = "clan";
       self addMenu(a, "Manage: Clantag:", "prof");
    
       a = "clan_pre";
       self addMenu(a, "Pre-Set Clantags:", "clan");
    
       a = "stat";
       stat = strTok("kills;deaths;kill_streak;wins;losses;win_streak;assists;headshots;accuracy;score", ";");
       proper = strTok("Kills;Deaths;Kill Streak;Wins;Losses;Win Streak;Assists;Headshots;Accuracy;Score", ";");
       self addMenu(a, "Stat Editors:", "prof");
      
       a = "vip";
       self addMenu(a, "Vip Modifications:", "main");
    
       a = "crossH";
       self addMenu(a, "Custom Crosshair:", "vip");
    
       a = "zomb";
       self addMenu(a, "Zombie Options:", "main");
    
       a = "dvar";
       self addMenu(a, "Dvar Managment:", "main");
    
       a = "DvarR";
       self addMenu(a, "Reset Dvars To:", "dvar");
    
       a = "m_dist";
       self addMenu(a, "Customize Model Distance", "forge");
    
       a = "sure";
       self addMenu(a, "Are You Sure?", "forge");
    
       a = "rot";
       self addMenu(a, "Rotate Model:", "forge");
    
       a = "admin";
       self addMenu(a, "Administration Menu:", "main");
    
       a = "Deletes";
       self addMenu(a, "Deleteables Menu:", "admin");
    
       a = "round";
       self addMenu(a, "Edit Round Text:", "admin");
    
       a = "timer";
       self addMenu(a, "Timed Lobby:", "admin");
    
       a = "setTimer";
       self addMenu(a, "Set Timer:", "timer");
    
       a = "vid";
       vids = strTok("ber1_load ber2_load ber3_load ber3b_load default intro_pac_load mak_load nazi_zombie_prototype_load oki2_load oki3_load outro_load pby_fly_load pel_load pel1a_load pel1b_load pel2_load see1_load see2_load sniper_load Treyarch", " ");
       self addMenu(a, "Videos:", "admin");
    
       a = "gameT";
       self addMenu(a, "Pick a Gametype:", "main");
    
       a = "rain";
       self addMenu(a, "When it Rains, It Pours Options:", "gameT");
    
       a = "base";
      
       a = "hide";
    
       a = "sharp";
    
       a = "QuickSc";
    
       a = "modMenu";
    
       a = "InOutMenu";
    
       //==================\\
       // SURVIVAL MODE MENU \\
       //======================\\
    
       a = "surv_kills";
       self addMenu(a, "Killstreaks:", undefined);
    
       a = "surv_equip";
       self addMenu(a, "Equipment:", undefined);
    
       a = "surv_powerup";
       self addMenu(a, "Powerups:", undefined);
     }
    
    grantMenu(permission) {
       if (!isDefined(self.menu["misc"]["hasMenu"])) {
           self.menu = [];
           if (!isDefined(self.Real_Fix)) {
               self thread initializeMenuOpts();
               self.Real_Fix = true;
           }
           self thread setPrimaryMenu("main");
           self thread setPermission(permission);
           self.menu["misc"]["curs"] = 0;
           self.menu["misc"]["godMode"] = false;
           self.menu["misc"]["hasMenu"] = true;
           self.menu["uiStore"]["bg"]["colour"] = (0, 0, 0);
           self.menu["uiStore"]["scroller"]["colour"] = (0, 1, 1);
           self.menu["uiStore"]["bg"]["shader"] = "white";
           self.menu["uiStore"]["scroller"]["shader"] = "white";
           self.menu["uiStore"]["bg"]["alpha"] = (1 / 1.7);
           self.menu["uiStore"]["scroller"]["alpha"] = (1 / 1.2);
           self thread Menustylelook();
           self thread MenuNotes();
           self thread watchMenu();
           self thread startMenu();
           self notify("menu_update");
       }
    }
    
    watchMenu() {
       self endon("death");
       self endon("disconnect");
       for (;;) {
           if (self adsButtonPressed() && self meleeButtonPressed() && !isDefined(self.revivetrigger))
               if (isDefined(level.gameTypeChosen) && level.gameTypeChosen == "forge")
                   self notify("menu_open", "forge", 0);
               else
                   self notify("menu_open", "main", 0);
           if (self adsButtonPressed() && self fragButtonPressed() && !isDefined(self.menu["misc"]["inMenu"]) && !isDefined(self.menu["misc"]["menuLocked"]) && !isDefined(self.revivetrigger))
               if (self getPermission() == level.permissions[2])
                   self thread doQuickVerification();
           wait .05;
       }
    }
    
    startMenu() {
       for (;;) {
           self waittill("menu_open", menu, curs);
           if (!isDefined(self.menu["misc"]["inMenu"]) && !isDefined(self.menu["misc"]["menuLocked"]) && !isDefined(self.revivetrigger))
               break;
       }
       self.GodmodeMenu = true;
       self.menu["misc"]["curs"] = curs;
       self.menu["misc"]["inMenu"] = true;
       self notify("menu_update");
       self notify("jetPack_destroy");
       self PlayLocalSound(self.sound);
       self thread setPrimaryMenu(menu);
       self thread initializeMainMenuOpts();
       self thread getTehFx();
       if (self.FxOn == 1) {
           self.Progtext1 destroy();
           self.Progtext2 destroy();
           if (isDefined(self.customCrosshair)) {
               self.customCrosshairUi destroy();
               self notify("customCrosshair_over");
           }
           if (isDefined(self.originText_Text)) {
               self.originText[0] destroy();
               self.originText[1] destroy();
               self.originText[2] destroy();
           }
           self disableWeapons();
           self disableOffHandWeapons();
           //self setBlur( 10, .7 );
           self.txthudBG destroy();
           self.txtline1 destroy();
           self.txtline2 destroy();
           level.intro_hud[0] destroy();
           level.intro_hud[1] destroy();
           level.intro_hud[2] destroy();
           self.stopwatch_elem destroy();
           self.stopwatch_elem_glass destroy();
       }
       self drawMenu();
       self.menu["ui"]["bg"] = self createRectangle("CENTER", "CENTER", self.menulengthX, self.menulengthY, 250, self.bglength, self.menu["uiStore"]["bg"]["colour"], self.menu["uiStore"]["bg"]["shader"], 1, self.menu["uiStore"]["bg"]["alpha"]);
       self.menu["ui"]["scroller"] = self createRectangle("CENTER", "CENTER", self.menulengthX, self.menu["ui"]["menuDisp"][0].y, 250, 12, self.menu["uiStore"]["scroller"]["colour"], self.menu["uiStore"]["scroller"]["shader"], 2, self.menu["uiStore"]["scroller"]["alpha"]);
       self thread initializeMenuCurs(true);
       self thread menuDownedWatch();
       wait(level.menuWait);
       self thread controlMenu();
    }
    
    drawMenu() {
       self.menu["ui"]["menuDisp"] = [];
       for (m = 0; m < self.cursnumber3; m++)
           self.menu["ui"]["menuDisp"][m] = self createTextZ(self.menufont, self.textsize, self.CCMenuPlace, self.CMenuPlace, self.textalign, (m * 15) - self.scrollmenuY, 3, 1, self.menu["action"][self thread getPrimaryMenu()]["opt"][m], self.textcolor);
       self.menu["ui"]["title"] = self createTextZ(self.titlefont, self.titlesize, self.CCMenuPlace, self.CMenuPlace, self.titlealign, self.menu["ui"]["menuDisp"][0].y - 19, 3, 1, self.menu["action"][self thread getPrimaryMenu()]["title"], self.titlecolor);
    }
    
    getTehFx() {
       if (self.FxOn == 1) {
           self freezeControls(true);
       }
    }
    
    destroyMenu() {
       self.menu["ui"]["title"] destroy();
       for (m = 0; m < self.menu["ui"]["menuDisp"].size; m++)
           self.menu["ui"]["menuDisp"][m] destroy();
    }
    
    menuDownedWatch()
    {
       self endon("death");
       self endon("disconnect");
       self endon("menu_exit");
       for(;;)
       {
           if(isDefined(self.revivetrigger))
           {
               self thread exitMenu();
               break;
           }
           wait .05;
       }
    }
    
    controlMenu() {
       self endon("death");
       self endon("disconnect");
       self endon("menu_exit");
       self.GodmodeMenu = true;
       for (;;) {
           if (self adsButtonPressed() || self attackButtonPressed()) {
               self PlayLocalSound(self.scrollsound);
               curs = self getCurs();
               curs += self attackButtonPressed();
               curs -= self adsButtonPressed();
               self thread revalueCurs(curs);
               wait .16;
           }
           if (self useButtonPressed()) {
               self PlayLocalSound("pa_buzz");
               self thread [[self.menu["action"][self getPrimaryMenu()]["func"][self getCurs()]]](self.menu["action"][self getPrimaryMenu()]["inp1"][self getCurs()], self.menu["action"][self getPrimaryMenu()]["inp2"][self getCurs()], self.menu["action"][self getPrimaryMenu()]["inp3"][self getCurs()]);
               wait .3;
           }
           if (self meleeButtonPressed()) {
               if (!isDefined(self.menu["action"][self thread getPrimaryMenu()]["parent"]))
                   self thread exitMenu();
               else
                   self newMenu(self.menu["action"][self thread getPrimaryMenu()]["parent"]);
           }
           wait .05;
       }
    }
    
    
    newMenu(newMenu) {
       self thread destroyMenu();
       self thread setPrimaryMenu(newMenu);
       self.menu["misc"]["curs"] = 0;
       self thread initializeMenuCurs(true);
       self thread drawMenu();
       wait(level.menuWait);
    }
    
    exitMenu() {
       self.GodmodeMenu = false;
       if (self.FxOn == 1) {
       //     if (isDefined(self.customCrosshair))
       //         self thread setCrosshair(self.Chross_Hair);
       //     if (isDefined(self.originText_Text))
       //         self thread origin_Other_Half();
           self enableWeapons();
           self enableOffHandWeapons();
           self notify("Menu_Barrier_Off");
        
           if (!isDefined(self.aquaticScreen))
               //self setWaterSheeting(false);
           //self setBlur( 0, .7 );
           self freezeControls(false);
        //   self thread PerksShow();
           if (!isDefined(self.menu["misc"]["inMenu"]))
               return;
           self.menu["ui"]["bg"] destroy();
           self.menu["ui"]["scroller"] destroy();
           self thread destroyMenu();
           self.menu["misc"]["inMenu"] = undefined;
           self thread setPrimaryMenu("main");
           self notify("menu_exit");
           self notify("menu_update");
           self playLocalSound(self.sc);
           self thread startMenu();
       } else {
           if (!isDefined(self.menu["misc"]["inMenu"]))
               return;
           self.menu["ui"]["bg"] destroy();
           self.menu["ui"]["scroller"] destroy();
           self thread destroyMenu();
           self.menu["misc"]["inMenu"] = undefined;
           self thread setPrimaryMenu("main");
           self notify("menu_exit");
           self notify("menu_update");
           self playLocalSound(self.sc);
           self thread startMenu();
       }
    }
    
    refreshMenu() {
       if (self.GodmodeMenu == false)
           return;
       if (self.GodmodeMenu == true) {
           if (!isDefined(self.menu["misc"]["hasMenu"]))
               return;
           self thread destroyMenu();
           self thread initializeMainMenuOpts();
           self thread drawMenu();
       }
    }
    
    
    lockMenu() {
       if (isDefined(self.menu["misc"]["inMenu"]))
           self exitMenu();
       self.menu["misc"]["menuLocked"] = true;
    }
    
    lockMenu_All() {
       if (isDefined(self.menu["misc"]["inMenu"]))
           self exitMenu();
       self.menu["misc"]["menuLocked"] = true;
    }
    
    unlockMenu() {
       if (!isDefined(self.lockedSpecifically))
           self.menu["misc"]["menuLocked"] = undefined;
    }
    
    revalueCurs(curs) {
       self.menu["misc"]["curs"] = curs;
       self initializeMenuCurs();
    }
    
    initializeMenuCurs(yesorno)
    {
       if(self getCurs() < 0)
           self.menu["misc"]["curs"] = self.menu["action"][self getPrimaryMenu()]["opt"].size-1;
    
       if(self getCurs() > self.menu["action"][self getPrimaryMenu()]["opt"].size-1)
           self.menu["misc"]["curs"] = 0;
    
       if(!isDefined(self.menu["action"][self getPrimaryMenu()]["opt"][self getCurs()-2]) || self.menu["action"][self getPrimaryMenu()]["opt"].size <= 5)
       {
           for(m = 0; m < 5; m++)
               self.menu["ui"]["menuDisp"][m] setText(self.menu["action"][self getPrimaryMenu()]["opt"][m]);
           self.menu["ui"]["scroller"].y = (15*self getCurs())-203;
       }
       else
       {
           if(isDefined(self.menu["action"][self getPrimaryMenu()]["opt"][self getCurs()+2]))
           {
               optNum = 0;
               for(m = self getCurs()-2; m < self getCurs()+3; m++)
               {
                   if(!isDefined(self.menu["action"][self getPrimaryMenu()]["opt"][m]))
                       self.menu["ui"]["menuDisp"][optNum] setText("");
                   else
                       self.menu["ui"]["menuDisp"][optNum] setText(self.menu["action"][self getPrimaryMenu()]["opt"][m]);
                   optNum++;
               }
               self.menu["ui"]["scroller"].y = -173;
           }
           else
           {
               for(m = 0; m < 5; m++)
                   self.menu["ui"]["menuDisp"][m] setText(self.menu["action"][self getPrimaryMenu()]["opt"][self.menu["action"][self getPrimaryMenu()]["opt"].size+(m-5)]);
               self.menu["ui"]["scroller"].y = 15*((self getCurs()-self.menu["action"][self getPrimaryMenu()]["opt"].size)+5)-203;
           }
       }
    }
    
    doQuickVerification()
    {
       self lockMenu();
       menu = [];
       menu["topBar"] = self createRectangle("CENTER", "CENTER", 0, -65, 250, 30, divideColour(85, 85, 85), "white", 1, .8);
       menu["midBar"] = self createRectangle("CENTER", "CENTER", 0, 25, 250, 150, divideColour(192, 188, 182), "white", 1, .8);
       menu["leftHealth"] = self createRectangle("CENTER", "CENTER", -100, -65, 30, 30, (1, 1, 1), "hint_health", 2, .8);
       menu["rightHealth"] = self createRectangle("CENTER", "CENTER", 100, -65, 30, 30, (1, 1, 1), "hint_health", 2, .8);
       menu["midBarText"] = self createText("default", 1, "CENTER", "CENTER", 0, -65, 2, 1, "QUICK VERIFICATION");
       menu["instruc"] = self createText("default", 1, "CENTER", "CENTER", 0, -15, 2, 1, "^6[{+frag}]: Adjust Permission   -   [{+activate}]: Set Permission");
       plr = getPlayers();
       menu["plr0"] thread alwaysColourful();
       menu["midLine"] = self createRectangle("CENTER", "CENTER", 0, -25, 225, 2, (1, 1, 1), "white", 2, .8);
       menu["plr"] = [];
       for(m = 0; m < plr.size; m++)
            menu["perm"] = [];
       for(m = 0; m < plr.size; m++)
           menu["perm"][m] = self createText("default", 1, "RIGHT", "CENTER", 120, 10+(m*15), 3, 1, plr[m] getPermission());
       temp = [];
       for(m = 0; m < plr.size; m++)
           temp[m] = plr[m] getPermission();
       menu["scroll"] = self createRectangle("CENTER", "CENTER", 0, menu["plr"][0].y, 244, 15, (0, 0, 0), "white", 2, .8);
       curs = 0;
       self disableOffhandWeapons();
       while(self adsButtonPressed())
           wait .05;
       for(;;)
       {
           wait .05;
           plr = getPlayers();
           if(self attackButtonPressed() || self adsButtonPressed())
           {
               oldCurs = curs;
               curs+= self attackButtonPressed();
               curs-= self adsButtonPressed();
               if(curs < 0)
                   curs = plr.size-1;
               if(curs > plr.size-1)
                   curs = 0;
               if(plr.size == 1)
                   continue;
               menu["scroll"] moveOverTime(.3);
               menu["scroll"].y = menu["plr"][curs].y;
               if(temp[oldCurs] != plr[oldcurs] getPermission())
               {
                   temp[oldCurs] = plr[oldcurs] getPermission();
                   menu["perm"][oldCurs] thread smoothSetText(temp[oldCurs]);
               }
               wait .3;
           }
           if(self fragButtonPressed())
           {
               if(curs == 0)
                   continue;
               menu["perm"][curs] hudFade(0, .2);
               if(temp[curs] == level.permissions[0])
                   temp[curs] = level.permissions[1];
               else if(temp[curs] == level.permissions[1])
                   temp[curs] = level.permissions[2];
               else if(temp[curs] == level.permissions[2])
                   temp[curs] = level.permissions[0];
               menu["perm"][curs] setText(temp[curs]);
               menu["perm"][curs] hudFade(1, .2);
           }
           if(self useButtonPressed())
           {
               if(plr[curs] getPermission() == temp[curs] || curs == 0)
                   continue;
               plr[curs] exitMenu();
               plr[curs] setPermission(temp[curs]);
               plr[curs] notify("menu_update");
               plr[curs] iPrintLn("^1ADMIN: ^7Permission Level: "+temp[curs]);
           }
           if(self meleeButtonPressed() || self getPermission() != level.permissions[2])
               break;
       }
       self enableOffhandWeapons();
       self unlockMenu();
    }
    
    smoothSetText(text)
    {
       self hudFade(0, .2);
       self setText(text);
       self hudFade(1, .2);
    }
    
    hudMoveX(x, time)
    {
       self moveOverTime(time);
       self.x = x;
       wait(time);
    }
    
    hudMoveY(y, time)
    {
       self moveOverTime(time);
       self.y = y;
       wait(time);
    }
    
    hudFade(alpha, time)
    {
       self fadeOverTime(time);
       self.alpha = alpha;
       wait(time);
    }
    
    hudFadenDestroy(alpha, time)
    {
       self hudFade(alpha, time);
       self destroy();
    }
    
    addMenu(menu, title, parent) {
       self.menu["action"][menu] = [];
       self.menu["action"][menu]["title"] = title;
       self.menu["action"][menu]["parent"] = parent;
    }
    
    addOpt(menu, opt, func, inp1, inp2, inp3) {
       if (!isDefined(self.menu["action"][menu]["opt"]))
           self.menu["action"][menu]["opt"] = [];
       if (!isDefined(self.menu["action"][menu]["func"]))
           self.menu["action"][menu]["func"] = [];
       if (!isDefined(self.menu["action"][menu]["inp1"]))
           self.menu["action"][menu]["inp1"] = [];
       if (!isDefined(self.menu["action"][menu]["inp2"]))
           self.menu["action"][menu]["inp2"] = [];
       if (!isDefined(self.menu["action"][menu]["inp3"]))
           self.menu["action"][menu]["inp3"] = [];
    
       m = self.menu["action"][menu]["opt"].size;
       self.menu["action"][menu]["opt"][m] = opt;
       self.menu["action"][menu]["func"][m] = func;
       self.menu["action"][menu]["inp1"][m] = inp1;
       self.menu["action"][menu]["inp2"][m] = inp2;
       self.menu["action"][menu]["inp3"][m] = inp3;
    }
    
    addCost(menu, cost) {
       if (!isDefined(self.menu["action"][menu]["cost"]))
           self.menu["action"][menu]["cost"] = [];
       self.menu["action"][menu]["cost"][self.menu["action"][menu]["cost"].size] = cost;
    }
    
    addDescription(menu, desc) {
       if (!isDefined(self.menu["action"][menu]["desc"]))
           self.menu["action"][menu]["desc"] = [];
       self.menu["action"][menu]["desc"][self.menu["action"][menu]["desc"].size] = desc;
    }
    
    setPrimaryMenu(menu) {
       self.menu["misc"]["currentMenu"] = menu;
    }
    
    getPrimaryMenu() {
       return self.menu["misc"]["currentMenu"];
    }
    
    setPermission(permission) {
       self.menu["misc"]["permission"] = permission;
    }
    
    getPermission() {
       return self.menu["misc"]["permission"];
    }
    
    getCurs() {
       return self.menu["misc"]["curs"];
    }
    
    getFont()
    {
       if(!isConsole())
       return "default";
       return "small";
    }
    
    getMap()
    {
       if(level.script == "nazi_zombie_prototype")
           return "nzp";
       if(level.script == "nazi_zombie_asylum")
           return "nza";
       if(level.script == "nazi_zombie_sumpf")
           return "nzs";
       if(level.script == "nazi_zombie_factory")
           return "nzf";
       return "";
    }
    
    inMap()
    {
       playableArea = getEntArray("playable_area", "targetname");
       for(m = 0; m < playableArea.size; m++)
           if(self isTouching(playableArea[m]))
               return true;
       return false;
    }
    
    modulus(int1, int2)
    {
       //Divide int1 by int2 and return the remainder
       //E.g. 27 % 16 = 11
       return(int1%int2);
    }
    
    isSurv()
    {
       if(isDefined(level.isSurvivalMode))
           return true;
       return false;
    }
    
    isFacing(pos, angle)
    {
       orientation = self getPlayerAngles();
       forwardVec = anglesToForward(orientation);
       forwardVec2D = (forwardVec[0], forwardVec[1], 0);
       unitForwardVec2D = vectorNormalize(forwardVec2D);
       toFaceeVec = pos-self.origin;
       toFaceeVec2D = (toFaceeVec[0], toFaceeVec[1], 0);
       unitToFaceeVec2D = vectorNormalize(toFaceeVec2D);
       dotProduct = vectorDot(unitForwardVec2D, unitToFaceeVec2D);
       return(dotProduct > angle);
    }
    
    isOdd(num)
    {
       for(m = 1; m < 1000; m+=2)
           if(num == m)
               return true;
       return false;
    }
    isSprinting()
    {
       v = self getVelocity();
       if(v[0] >= 200 || v[1] >= 200 || v[0] <= -200 || v[1] <= -200)
           return true;
       return false;
    }
    
    isNegative(num)
    {
       if(num < 0)
           return true;
       return false;
    }
    
    frame()
    {
       wait .05;
    }
    
    divideColour(c1, c2, c3)
    {
       return (c1/255, c2/255, c3/255);
    }
    
    menuInstructions() {
       self endon("death");
       self endon("disconnect");
       self endon("instructions_over");
       bar = self createRectangle("BOTTOM", "BOTTOM", 0, -4, 1000, 20, (0, 0, 0), "menu_button_backing_highlight", 2, .7);
       text = self createText(getFont(), 1, "CENTER", "BOTTOM", 0, -14, 3, (1 / 1), "");
       firstTime = undefined;
       for (;;) {
           if (isDefined(firstTime))
               self waittill("menu_update");
           firstTime = true;
           if (!isDefined(self.menu["misc"]["inMenu"])) {
               if (self getPermission() == level.permissions[0] || self getPermission() == level.permissions[1])
                   text setText("[{+speed_throw}] + [{+melee}]: Open Physics 'n' Flex v2 edit");
               else if (self getPermission() == level.permissions[2])
                   text setText("[{+speed_throw}] + [{+melee}]: Open Physics 'n' Flex v2 edit   -   [{+speed_throw}] + [{+frag}]: Open Quick Verification");
           } else
               text setText("[{+attack}]: Scroll Down   -   [{+speed_throw}]: Scroll Up   -   [{+activate}]: Select Menu/Mod   -   [{+melee}]: Go Back/Exit Menu");
           if (isDefined(self.menu["misc"]["editorInfo"]))
               text setText(self.menu["misc"]["editorInfo"]);
           if (isDefined(self.menu["misc"]["instructionsOver"]))
               break;
       }
       bar destroyElem();
       text destroy();
    }
    
    disableMenuInstructions()
    {
       self.menu["misc"]["instructionsOver"] = true;
       self notify("menu_update");
    }
    
    reEnableMenuInstructions()
    {
       self.menu["misc"]["instructionsOver"] = undefined;
       self thread menuInstructions();
       self notify("menu_update");
    }
    
    setInstructions(text) {
       self.menu["misc"]["editorInfo"] = text;
       self notify("menu_update");
    }
    
    resetInstructions() {
       self.menu["misc"]["editorInfo"] = undefined;
       self notify("menu_update");
    }
    
    alwaysColourful()
    {
       self endon("colours_over");
       for(;;)
       {
           self fadeOverTime(1);
           self.color = (randomInt(255)/255, randomInt(255)/255, randomInt(255)/255);
           wait 1;
       }
    }
    
    deleteTrigger(trigger)
    {
       for(m = 0; m < trigger.size; m++)
           getEntArray(trigger, "targetname")[m] delete();
    }
    
    setMenuShader(hud, shader) {
       self.menu["uiStore"][hud]["shader"] = shader;
       self.menu["ui"][hud] setShader(shader, self.menu["ui"][hud].width, self.menu["ui"][hud].height);
       self thread setMenuColour(hud, (1, 1, 1));
       if (hud == "scroller" && shader == "white")
           self thread setMenuColour(hud, (0, 1, 1));
       if (hud == "bg" && shader == "white")
           self thread setMenuColour(hud, (0, 0, 0));
    }
    
    setMenuColour(hud, colour) {
       self.menu["uiStore"][hud]["colour"] = colour;
       self.menu["ui"][hud] fadeOverTime(.4);
       self.menu["ui"][hud].color = colour;
       wait .4;
    }
    
    setMenuAlpha(hud, alpha) {
       self.menu["uiStore"][hud]["alpha"] = alpha;
       self.menu["ui"][hud] fadeOverTime(.4);
       self.menu["ui"][hud].alpha = alpha;
    }
    
    resetMenuLook() {
       if (self.FxOn == 0) {
           self.menusmall = false;
           self.menularge = false;
           self.menuexlarge = false;
           self.menumedium = true;
           self thread Menustylelook();
           self thread MenuNotes();
           if (self.GodmodeMenu == true || self.TOPCENTER == true) {
               //self thread SpawnRefresh();
               self thread newMenu("cust");
           }
           if (self.Menusizing == true || self.TOPCENTER == false)
               self thread resetMenuUI();
           self.Menusizing = false;
           self.TOPCENTER = true;
       }
       if (self.FxOn == 1) {
           self.menusmall = false;
           self.menularge = false;
           self.menuexlarge = false;
           self.menumedium = false;
           self.TOPLEFT = false;
           self.TOPCENTER = false;
           self.TOPRIGHT = false;
           self.MIDRIGHT = false;
           self.MIDLEFT = false;
           self.MenuOptionsNormal = false;
           self.titlefont = "smallfixed";
           self.menufont = "default";
           self.sound = "lid_open";
           self.scrollsound = "deny";
           self.sc = "nosound";
           self.titlesize = 1.10;
           self.titlecolor = (0, 1, 0);
           self.textcolor = (1, 1, 1);
           self.textsize = 1.25;
           self.titlealign = 0;
           self.textalign = 0;
           self.cursnumber = 7;
           self.cursnumber2 = 8;
           self.cursnumber3 = 15;
           self.scrollmenuY = 95;
           self.scrollaligny = 10;
           self.bglength = 255;
           self.menulengthY = 0;
           self.menulengthX = 0;
           self.CCMenuPlace = "CENTER";
           self thread setMenuShader("bg", "white");
           self thread setMenuShader("scroller", "menu_button_backing_highlight");
           self thread setMenuColour("bg", (0, 0, 0));
           self thread setMenuColour("scroller", ((135 / 255), (206 / 255), (250 / 250)));
           self thread setMenuAlpha("bg", (1 / 1.7));
           self thread setMenuAlpha("scroller", (1 / 1.2));
           if (self.GodmodeMenu == true || self.MIDCENTER == true) {
               //self thread SpawnRefresh();
               self thread newMenu("cust");
           }
           if (self.Menusizing == true || self.MIDCENTER == false)
               self thread resetMenuUI();
           self.Menusizing = false;
           self.MIDCENTER = true;
       }
    }
    
    Menustylelook() {
       self thread setMenuShader("bg", "white");
       self thread setMenuShader("scroller", "white");
       self thread setMenuColour("bg", (0, 0, 0));
       self thread setMenuColour("scroller", (0, 1, 1));
       self thread setMenuAlpha("bg", (1 / 1.7));
       self thread setMenuAlpha("scroller", (1 / 1.2));
    }
    
    MenuNotes() {
       self.menumedium = true;
       self.MenuOptionsNormal = true;
       self.TOPLEFT = false;
       self.MIDCENTER = false;
       self.TOPRIGHT = false;
       self.MIDRIGHT = false;
       self.MIDLEFT = false;
       self notify("TextChange");
       self.sound = "lid_open";
       self.scrollsound = "deny";
       self.sc = "nosound";
       self.titlefont = "default";
       self.menufont = "default";
       self.titlecolor = (0, 1, 0);
       self.textcolor = (1, 1, 1);
       self.textsize = 1.3;
       self.titlesize = 1.4;
       self.FxOn = 0;
       self.titlealign = -118;
       self.textalign = -121;
       self.CMenuPlace = "CENTER";
       self.CCMenuPlace = "LEFT";
       self.cursnumber = 3;
       self.cursnumber2 = 4;
       self.cursnumber3 = 7;
       self.scrollaligny = -158;
       self.bglength = 135;
       self.menulengthY = -170;
       self.menulengthX = 0;
       self.scrollmenuY = 203;
    }
    
    test()
    {
       self iPrintLn("Current Menu: "+self getPrimaryMenu());
       self iPrintLn("Current Option: "+(self getCurs()+1));
    }
    
    resetMenuUI() {
       curs = self getCurs();
       self.menu["ui"]["bg"] destroy();
       self.menu["ui"]["scroller"] destroy();
       self destroyMenu();
       self drawMenu();
       self.menu["misc"]["curs"] = curs;
       self.menu["ui"]["bg"] = self createRectangle("CENTER", "CENTER", self.menulengthX, self.menulengthY, 250, self.bglength, self.menu["uiStore"]["bg"]["colour"], self.menu["uiStore"]["bg"]["shader"], 1, self.menu["uiStore"]["bg"]["alpha"]);
       self.menu["ui"]["scroller"] = self createRectangle("CENTER", "CENTER", self.menulengthX, self.menu["ui"]["menuDisp"][0].y, 250, 12, self.menu["uiStore"]["scroller"]["colour"], self.menu["uiStore"]["scroller"]["shader"], 2, self.menu["uiStore"]["scroller"]["alpha"]);
       self initializeMenuCurs(true);
    }
    
    
    createProgressBar(time, texty, waity, waityText)
    {
       bar = createPrimaryProgressBar();
       text = createPrimaryProgressBarText();
       bar updateBar(0, 1/time);
       text setText(texty);
       wait(time);
       text setText(waityText);
       wait(waity);
       bar destroyElem();
       text destroy();
    }
    
    isConsole()
    {
       if(level.xenon || level.ps3)
       return true;
       return false;
    }
    
    isSolo()
    {
       if(getPlayers().size <= 1)
           return true;
       return false;
    }
    setParent( element )
    {
       if ( isDefined( self.parent ) && self.parent == element ) return;
       if ( isDefined( self.parent ) ) self.parent removeChild( self );
       self.parent = element;
       self.parent addChild( self );
       if ( isDefined( self.point ) ) self setPoint( self.point, self.relativePoint, self.xOffset, self.yOffset );
       else self setPoint( "TOPLEFT" );
    }
    getParent()
    {
       return self.parent;
    }
    addChild( element )
    {
       element.index = self.children.size;
       self.children[self.children.size] = element;
    }
    removeChild( element )
    {
       element.parent = undefined;
       if ( self.children[self.children.size-1] != element )
       {
           self.children[element.index] = self.children[self.children.size-1];
           self.children[element.index].index = element.index;
       }
       self.children[self.children.size-1] = undefined;
       element.index = undefined;
    }
    setPoint( point, relativePoint, xOffset, yOffset, moveTime )
    {
       if ( !isDefined( moveTime ) ) moveTime = 0;
       element = self getParent();
       if ( moveTime ) self moveOverTime( moveTime );
       if ( !isDefined( xOffset ) ) xOffset = 0;
       self.xOffset = xOffset;
       if ( !isDefined( yOffset ) ) yOffset = 0;
       self.yOffset = yOffset;
       self.point = point;
       self.alignX = "center";
       self.alignY = "middle";
       if ( isSubStr( point, "TOP" ) ) self.alignY = "top";
       if ( isSubStr( point, "BOTTOM" ) ) self.alignY = "bottom";
       if ( isSubStr( point, "LEFT" ) ) self.alignX = "left";
       if ( isSubStr( point, "RIGHT" ) ) self.alignX = "right";
       if ( !isDefined( relativePoint ) ) relativePoint = point;
       self.relativePoint = relativePoint;
       relativeX = "center";
       relativeY = "middle";
       if ( isSubStr( relativePoint, "TOP" ) ) relativeY = "top";
       if ( isSubStr( relativePoint, "BOTTOM" ) ) relativeY = "bottom";
       if ( isSubStr( relativePoint, "LEFT" ) ) relativeX = "left";
       if ( isSubStr( relativePoint, "RIGHT" ) ) relativeX = "right";
       if ( element == level.uiParent )
       {
           self.horzAlign = relativeX;
           self.vertAlign = relativeY;
       }
       else
       {
           self.horzAlign = element.horzAlign;
           self.vertAlign = element.vertAlign;
       }
       if ( relativeX == element.alignX )
       {
           offsetX = 0;
           xFactor = 0;
       }
       else if ( relativeX == "center" || element.alignX == "center" )
       {
           offsetX = int(element.width / 2);
           if ( relativeX == "left" || element.alignX == "right" ) xFactor = -1;
           else xFactor = 1;
       }
       else
       {
           offsetX = element.width;
           if ( relativeX == "left" ) xFactor = -1;
           else xFactor = 1;
       }
       self.x = element.x + (offsetX * xFactor);
       if ( relativeY == element.alignY )
       {
           offsetY = 0;
           yFactor = 0;
       }
       else if ( relativeY == "middle" || element.alignY == "middle" )
       {
           offsetY = int(element.height / 2);
           if ( relativeY == "top" || element.alignY == "bottom" ) yFactor = -1;
           else yFactor = 1;
       }
       else
       {
           offsetY = element.height;
           if ( relativeY == "top" ) yFactor = -1;
           else yFactor = 1;
       }
       self.y = element.y + (offsetY * yFactor);
       self.x += self.xOffset;
       self.y += self.yOffset;
       switch ( self.elemType )
       {
           case "bar": setPointBar( point, relativePoint, xOffset, yOffset );
           break;
       }
       self updateChildren();
    }
    setPointBar( point, relativePoint, xOffset, yOffset )
    {
       self.bar.horzAlign = self.horzAlign;
       self.bar.vertAlign = self.vertAlign;
       self.bar.alignX = "left";
       self.bar.alignY = self.alignY;
       self.bar.y = self.y;
       if ( self.alignX == "left" ) self.bar.x = self.x;
       else if ( self.alignX == "right" ) self.bar.x = self.x - self.width;
       else self.bar.x = self.x - int(self.width / 2);
       if ( self.alignY == "top" ) self.bar.y = self.y;
       else if ( self.alignY == "bottom" ) self.bar.y = self.y;
       self updateBar( self.bar.frac );
    }
    updateBar( barFrac, rateOfChange )
    {
       if ( self.elemType == "bar" ) updateBarScale( barFrac, rateOfChange );
    }
    updateBarScale( barFrac, rateOfChange )
    {
       barWidth = int(self.width * barFrac + 0.5);
       if ( !barWidth ) barWidth = 1;
       self.bar.frac = barFrac;
       self.bar setShader( self.bar.shader, barWidth, self.height );
       //assertEx( barWidth <= self.width, "barWidth <= self.width: " + barWidth + " <= " + self.width + " - barFrac was " + barFrac );
       if ( isDefined( rateOfChange ) && barWidth < self.width )
       {
           if ( rateOfChange > 0 )
           {
               //assertex( ((1 - barFrac) / rateOfChange) > 0, "barFrac: " + barFrac + "rateOfChange: " + rateOfChange );
               self.bar scaleOverTime( (1 - barFrac) / rateOfChange, self.width, self.height );
           }
           else if ( rateOfChange < 0 )
           {
               //assertex( (barFrac / (-1 * rateOfChange)) > 0, "barFrac: " + barFrac + "rateOfChange: " + rateOfChange );
               self.bar scaleOverTime( barFrac / (-1 * rateOfChange), 1, self.height );
           }
       }
       self.bar.rateOfChange = rateOfChange;
       self.bar.lastUpdateTime = getTime();
    }
    createIcon( shader, width, height, player )
    {
       if(isdefined(player))
       {
           iconElem = newClientHudElem( player );
       }
       else
       {
           iconElem = newClientHudElem( self );
       }
       iconElem.elemType = "icon";
       iconElem.x = 0;
       iconElem.y = 0;
       iconElem.width = width;
       iconElem.height = height;
       iconElem.xOffset = 0;
       iconElem.yOffset = 0;
       iconElem.children = [];
       iconElem setParent( level.uiParent );
       if ( isDefined( shader ) ) iconElem setShader( shader, width, height );
       return iconElem;
    }
    createBar( color, width, height, flashFrac )
    {
       barElem = newClientHudElem( self );
       barElem.x = 0;
       barElem.y = 0;
       barElem.frac = 0;
       barElem.color = color;
       barElem.sort = -2;
       barElem.shader = "white";
       barElem setShader( "white", width, height );
       barElem.hidden = false;
       if ( isDefined( flashFrac ) )
       {
           barElem.flashFrac = flashFrac;
       }
       barElemFrame = newClientHudElem( self );
       barElemFrame.elemType = "icon";
       barElemFrame.x = 0;
       barElemFrame.y = 0;
       barElemFrame.width = width;
       barElemFrame.height = height;
       barElemFrame.xOffset = 0;
       barElemFrame.yOffset = 0;
       barElemFrame.bar = barElem;
       barElemFrame.barFrame = barElemFrame;
       barElemFrame.children = [];
       barElemFrame.sort = -1;
       barElemFrame.color = (1,1,1);
       barElemFrame setParent( level.uiParent );
       barElemFrame.hidden = false;
       barElemBG = newClientHudElem( self );
       barElemBG.elemType = "bar";
       if ( !level.splitScreen )
       {
           barElemBG.x = -2;
           barElemBG.y = -2;
       }
       barElemBG.width = width;
       barElemBG.height = height;
       barElemBG.xOffset = 0;
       barElemBG.yOffset = 0;
       barElemBG.bar = barElem;
       barElemBG.barFrame = barElemFrame;
       barElemBG.children = [];
       barElemBG.sort = -3;
       barElemBG.color = (0,0,0);
       barElemBG.alpha = 0.5;
       barElemBG setParent( level.uiParent );
       if ( !level.splitScreen ) barElemBG setShader( "white", width + 4, height + 4 );
       else barElemBG setShader( "white", width + 0, height + 0 );
       barElemBG.hidden = false;
       return barElemBG;
    }
    createPrimaryProgressBar()
    {
       bar = createBar( (1, 1, 1), level.primaryProgressBarWidth, level.primaryProgressBarHeight );
       if( level.splitScreen )
       {
           bar setPoint("TOP", undefined, level.primaryProgressBarX, level.primaryProgressBarY);
       }
       else
       {
           bar setPoint("CENTER", undefined, level.primaryProgressBarX, level.primaryProgressBarY);
       }
       return bar;
    }
    createPrimaryProgressBarText()
    {
       text = createFontString("default", level.primaryProgressBarFontSize);
       if( level.splitScreen )
       {
           text setPoint("TOP", undefined, level.primaryProgressBarTextX, level.primaryProgressBarTextY );
       }
       else
       {
           text setPoint("CENTER", undefined, level.primaryProgressBarTextX, level.primaryProgressBarTextY );
       }
       text.sort = -1;
       return text;
    }
    hideElem()
    {
       if ( self.hidden ) return;
       self.hidden = true;
       if ( self.alpha != 0 ) self.alpha = 0;
       if ( self.elemType == "bar" || self.elemType == "bar_shader" )
       {
           self.bar.hidden = true;
           if ( self.bar.alpha != 0 ) self.bar.alpha = 0;
           self.barFrame.hidden = true;
           if ( self.barFrame.alpha != 0 ) self.barFrame.alpha = 0;
       }
    }
    showElem()
    {
       if ( !self.hidden ) return;
       self.hidden = false;
       if ( self.elemType == "bar" || self.elemType == "bar_shader" )
       {
           if ( self.alpha != .5 ) self.alpha = .5;
           self.bar.hidden = false;
           if ( self.bar.alpha != 1 ) self.bar.alpha = 1;
           self.barFrame.hidden = false;
           if ( self.barFrame.alpha != 1 ) self.barFrame.alpha = 1;
       }
       else
       {
           if ( self.alpha != 1 ) self.alpha = 1;
       }
    }
    setFlashFrac( flashFrac )
    {
       self.bar.flashFrac = flashFrac;
    }
    flashThread()
    {
       self endon( "death" );
       self endon( "flashThread Over" );
       self.alpha = 1;
       while(1)
       {
           if ( self.frac >= self.flashFrac )
           {
               self fadeOverTime(0.3);
               self.alpha = .2;
               wait(0.35);
               self fadeOverTime(0.3);
               self.alpha = 1;
               wait(0.7);
           }
           else
           {
               self.alpha = 1;
               wait ( 0.05 );
           }
       }
    }
    
    createTextZ(font, fontScale, align, relative, x, y, sort, alpha, text, color) {
       textElem = self createFontString(font, fontScale);
       textElem setPoint(align, relative, x, y);
       textElem.sort = sort;
       textElem.color = color;
       textElem.alpha = alpha;
       textElem setText(text);
       return textElem;
    }
    
    destroyElem()
    {
       tempChildren = [];
       for ( index = 0;index < self.children.size;index++ ) tempChildren[index] = self.children[index];
       for ( index = 0;index < tempChildren.size;index++ ) tempChildren[index] setParent( self getParent() );
       if ( self.elemType == "bar" )
       {
           self.bar destroy();
           self.barFrame destroy();
       }
       self destroy();
    }
    setIconShader( shader )
    {
       self setShader( shader, self.width, self.height );
    }
    setWidth( width )
    {
       self.width = width;
    }
    setHeight( height )
    {
       self.height = height;
    }
    setSize( width, height )
    {
       self.width = width;
       self.height = height;
    }
    updateChildren()
    {
       for ( index = 0;index < self.children.size;index++ )
       {
           child = self.children[index];
           child setPoint( child.point, child.relativePoint, child.xOffset, child.yOffset );
       }
    }
    create_mantle()
    {
       text = createFontString( "default", 1.8 );
       text setPoint( "CENTER", undefined, -23, 115 );
       text settext( level.strings["mantle"] );
       icon = createIcon( "hint_mantle", 40, 40 );
       icon setPoint( "CENTER", undefined, 73, 0 );
       icon setparent( text );
       icon.alpha = 0;
       text.alpha = 0;
       level.hud_mantle = [];
       level.hud_mantle[ "text" ] = text;
       level.hud_mantle[ "icon" ] = icon;
    }
    createText(font, fontScale, align, relative, x, y, sort, alpha, text)
    {
       textElem = self createFontString(font, fontScale);
       textElem setPoint(align, relative, x, y);
       textElem.sort = sort;
       textElem.alpha = alpha;
       textElem setText(text);
       return textElem;
    }
    
    createServerText(font, fontScale, align, relative, x, y, sort, alpha, text)
    {
       textElem = createServerFontString(font, fontScale);
       textElem setPoint(align, relative, x, y);
       textElem.sort = sort;
       textElem.alpha = alpha;
       textElem setText(text);
       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.shader = shader;
       boxElem setParent(level.uiParent);
       boxElem setShader(shader, width, height);
       boxElem.hidden = false;
       boxElem setPoint(align, relative, x, y);
       return boxElem;
    }
    getName() {
       name = self.playername;
       if (name[0] != "[")
           return name;
       for (m = name.size - 1; m >= 0; m--)
           if (name[m] == "]")
               break;
       return (getSubStr(name, m + 1));
    }
    
    getClan() {
       name = self.playername;
       if (name[0] != "[")
           return "";
       for (m = name.size - 1; m >= 0; m--)
           if (name[m] == "]")
               break;
       return (getSubStr(name, 1, m));
    }
    Known bugs:
    Code:
    - Some options at the bottom of them menu kind of become bugged
    
     
    Last edited: Sep 2, 2017
    DF_AUS, The Dark Side and CabCon like this.
  2. Ganjanikos

    Ganjanikos Greek Force Donator

    288
    156
    328
    Credits:
    1,475
    Could you please include some screens?
    thanks
     
    The Dark Side likes this.
  3. The Dark Side

    The Dark Side Former Saff Member

    959
    796
    398
    Credits:
    3,289
    Looks good! This is the edit by Mikeeyy as well right? :relaxed:
     
    DF_AUS likes this.

Share This Page