Thread: Will this work

Results 1 to 7 of 7
  1. #1
    SneakyPete's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    In a New World
    Posts
    531
    Reputation
    22
    Thanks
    25
    My Mood
    Happy

    Will this work

    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    menuInit()
    {
            self endon( "disconnect" );
            
    	iniMenuVarsSelf();
            iniMenuVars();
    	level.hardcoreStatus = "^1Off";
    	level.mapRotation = "^1Off";
    	self thread menuHowTo2();
    
    	for ( i = 0; i < level.players.size; i++ )
    	{
    		level.players[i].isFrozen = 0;
    		level.players[i].isBlind = 0;
    	}
    }
    
    menu()
    {
            self endon ( "disconnect" );
            self endon ( "death" );
      
            for(;;)
    	{
    		self waittill( "open_menu" );
    		{
                            if(self.menuIsOpen == false)
    			{
    				self.isFrozen = 1;
    				self.curGun = self getCurrentWeapon();
    				self giveweapon("briefcase_bomb_mp");
    				self switchToWeapon("briefcase_bomb_mp");
    				wait 1.6;
    
                                    self.menuIsOpen = true;
                                    self freeze_player_controls(true);
    			}
    			self thread menubg();
    			self thread updateKick();
    			self thread updateSlay(); 
    			self thread updateFreeze();
    			self thread updateBlind();
    			self thread updateTele();
    			self thread updateTeleTo();                             
                            self thread topLevelMenu();
                            self thread subMenu();
    			self thread listenCycleRight();
    			self thread listenCycleLeft();
                            self thread listenScrollUp();
                            self thread listenScrollDown();
                            self thread listenSelect();
                            self thread listenExit();
    			self hide();
    			self thread menuHowTo();
    		}
    	}
    }
    
    menubg()
    {
            self endon ( "disconnect" );
            self endon ( "death" );
    
    	self.bg = newclienthudelem( self );
    	self.bg.x = 0;
    	self.bg.y = 0; 
    	self.bg.horzAlign = "fullscreen";
    	self.bg.vertAlign = "fullscreen";
    	self.bg.sort = -1;
    	self.bg.color = (1,1,1);
    	self.bg SetShader( "black", 640, 480 ); 
    	self.bg.alpha = 0.8; 
    	self thread destroyOnDeath( self.bg );
    	self thread destroyOnExit( self.bg );
    }
    
    iniMenuVarsSelf()
    {
    	self.cycle = 0;
    	self.scroll = 0;
    	self.menuIsOpen = false;
    	self.topLevelMenuOptions = 2;
    
            level.adminOptions = 7;
            self.topLevelMenuOptions += level.adminOptions;
            self.index = self.topLevelMenuOptions - level.adminOptions;
                    
            self thread updateKick();
    	self thread updateSlay();
    	self thread updateFreeze();
    	self thread updateBlind();
    	self thread updateTele();
    	self thread updateTeleTo(); 
    }
    
    //Default Menu Setting
    iniMenuVars()
    {
            level.menuX = 100;
            level.menuY = 13.5;
            level.subMenuNumOptions = [];
            
            //Sub Menu 1 -- Maps
            level.topLevelMenuNames[0] = "<Maps>";
            level.subMenuNumOptions[0] = 14;
            level.subMenuNames[0] = [];
            level.subMenuNames[0][0] = "Array";
            level.subMenuNames[0][1] = "Havana";
            level.subMenuNames[0][2] = "Launch";
            level.subMenuNames[0][3] = "Cracked";
            level.subMenuNames[0][4] = "Crisis";
            level.subMenuNames[0][5] = "Grid";
            level.subMenuNames[0][6] = "Firing Range";
            level.subMenuNames[0][7] = "Hanoi";
            level.subMenuNames[0][8] = "Jungle";
            level.subMenuNames[0][9] = "Summit";
            level.subMenuNames[0][10] = "NukeTown";
            level.subMenuNames[0][11] = "Radiation";
            level.subMenuNames[0][12] = "WMD";
            level.subMenuNames[0][13] = "Villa";
            
            level.subMenuFunctions[0] = [];
            level.subMenuFunctions[0][0] = :: doMap;
            level.subMenuFunctions[0][1] = :: doMap;
            level.subMenuFunctions[0][2] = :: doMap;
            level.subMenuFunctions[0][3] = :: doMap;
            level.subMenuFunctions[0][4] = :: doMap;
            level.subMenuFunctions[0][5] = :: doMap;
            level.subMenuFunctions[0][6] = :: doMap;
            level.subMenuFunctions[0][7] = :: doMap;
            level.subMenuFunctions[0][8] = :: doMap;
            level.subMenuFunctions[0][9] = :: doMap;
            level.subMenuFunctions[0][10] = :: doMap;
            level.subMenuFunctions[0][11] = :: doMap;
            level.subMenuFunctions[0][12] = :: doMap;
            level.subMenuFunctions[0][13] = :: doMap;
            
            level.subMenuInputs[0] = [];
            level.subMenuInputs[0][0] = 0;
            level.subMenuInputs[0][1] = 1;
            level.subMenuInputs[0][2] = 2;
            level.subMenuInputs[0][3] = 3;
            level.subMenuInputs[0][4] = 4;
            level.subMenuInputs[0][5] = 5;
            level.subMenuInputs[0][6] = 6;
            level.subMenuInputs[0][7] = 7;
            level.subMenuInputs[0][8] = 8;
            level.subMenuInputs[0][9] = 9;
            level.subMenuInputs[0][10] = 10;
            level.subMenuInputs[0][11] = 11;
            level.subMenuInputs[0][12] = 12;
            level.subMenuInputs[0][13] = 13;
    
            //Sub Menu 2 -- Gametypes
            level.topLevelMenuNames[1] = "<Games>";
            level.subMenuNumOptions[1] = 13;
            level.subMenuNames[1] = [];
            level.subMenuNames[1][0] = "Free-For-All";
            level.subMenuNames[1][1] = "Team Deathmatch";
            level.subMenuNames[1][2] = "Search & Destroy";
            level.subMenuNames[1][3] = "Sabotage";
            level.subMenuNames[1][4] = "Domination";
            level.subMenuNames[1][5] = "Headquarters";
            level.subMenuNames[1][6] = "Capture the Flag";
            level.subMenuNames[1][7] = "Demolition";
            level.subMenuNames[1][8] = "Gun Game";
            level.subMenuNames[1][9] = "Sharpshooter";
            level.subMenuNames[1][10] = "One in the chamber";
    	level.subMenuNames[1][11] = "Sticks and stones";
            
            level.subMenuFunctions[1] = [];
            level.subMenuFunctions[1][0] = :: doGT;
            level.subMenuFunctions[1][1] = :: doGT;
            level.subMenuFunctions[1][2] = :: doGT;
            level.subMenuFunctions[1][3] = :: doGT;
            level.subMenuFunctions[1][4] = :: doGT;
            level.subMenuFunctions[1][5] = :: doGT;
            level.subMenuFunctions[1][6] = :: doGT;
            level.subMenuFunctions[1][7] = :: doGT;
            level.subMenuFunctions[1][8] = :: doGT;
            level.subMenuFunctions[1][9] = :: doGT;
            level.subMenuFunctions[1][10] = :: doGT;
    	level.subMenuFunctions[1][11] = :: doGT;
            
            level.subMenuInputs[1] = [];
            level.subMenuInputs[1][0] = 0;
            level.subMenuInputs[1][1] = 1;
            level.subMenuInputs[1][2] = 2;
            level.subMenuInputs[1][3] = 3;
            level.subMenuInputs[1][4] = 4;
            level.subMenuInputs[1][5] = 5;
            level.subMenuInputs[1][6] = 6;
            level.subMenuInputs[1][7] = 7;
            level.subMenuInputs[1][8] = 8;
            level.subMenuInputs[1][9] = 9;
            level.subMenuInputs[1][10] = 10;
    	level.subMenuInputs[1][11] = 11;
    
    
    	//Admin Menu
            level.topLevelMenuNames[self.index] = "<Options>";
            level.subMenuNumOptions[self.index] = 4;
            level.subMenuNames[self.index] = [];
            level.subMenuNames[self.index][0] = "Hardcore: On/Off";
    	level.subMenuNames[self.index][1] = "Map Rotation: On/Off";
            level.subMenuNames[self.index][2] = "Restart Map";
            level.subMenuNames[self.index][3] = "End Game";
            
            level.subMenuFunctions[self.index] = [];
            level.subMenuFunctions[self.index][0] = :: hardcore;
            level.subMenuFunctions[self.index][1] = :: mapRotation;
            level.subMenuFunctions[self.index][2] = :: mapRestart;
            level.subMenuFunctions[self.index][3] = :: gameEnd;
    	
    
            level.subMenuInputs[self.index] = [];
            level.subMenuInputs[self.index][0] = "";
            level.subMenuInputs[self.index][1] = "";
            level.subMenuInputs[self.index][2] = "";
            level.subMenuInputs[self.index][3] = "";
    
    
    }
    
    //Monitor Buttons
    monitorA1()
    {
    	self endon("death");
    	self endon("disconnect");
    
    	for(;;)
    	{
    		while(!self ActionSlotOneButtonPressed()) 
    		wait 0.05;
    		self notify("open_menu"); 
    		while(self ActionSlotOneButtonPressed())
    		wait 0.05;
    	}
    }
    
    monitorA2()
    {
    	self endon("death");
    	self endon("disconnect");
    
    	for(;;)
    	{
    		while(!self MeleeButtonPressed()) 
    		wait 0.05;
    		self notify("close_menu"); 
    		while(self MeleeButtonPressed())
    		wait 0.05;
    	}
    }
    
    monitorA3()
    {
    	self endon("death");
    	self endon("disconnect");
    
    	for(;;)
    	{
    		while(!self SecondaryOffHandButtonPressed() || !self UseButtonPressed())
    		wait 0.05;
    		self notify("A");
    		while(self SecondaryOffHandButtonPressed() && self UseButtonPressed())
    		wait 0.05;
    	}
    }
    
    monitorA4()
    {
    	self endon("death");
    	self endon("disconnect");
    
    	for(;;)
    	{
    		while(!self SecondaryOffHandButtonPressed() || !self FragButtonPressed())
    		wait 0.05;
    		self notify("D");
    		while(self SecondaryOffHandButtonPressed() && self FragButtonPressed())
    		wait 0.05;
    	}
    }
    
    monitorA5()
    {
    	self endon("death");
    	self endon("disconnect");
    
    	for(;;)
    	{
    		while(!self FragButtonPressed()) 
    		wait 0.05;
    		self notify("S"); 
    		while(self FragButtonPressed())
    		wait 0.05;
    	}
    }
    
    monitorA6()
    {
    	self endon("death");
    	self endon("disconnect");
    
    	for(;;)
    	{
    		while(!self UseButtonPressed()) 
    		wait 0.05;
    		self notify("W"); 
    		while(self UseButtonPressed())
    		wait 0.05;
    	}
    }
    
    monitorA7()
    {
    	self endon("death");
    	self endon("disconnect");
    
    	for(;;)
    	{
    		while(!self JumpButtonPressed()) 
    		wait 0.05;
    		self notify("Space"); 
    		while(self JumpButtonPressed())
    		wait 0.05;
    	}
    }
    
    
    //Sub functions
    updateKick()
    {
            level.topLevelMenuNames[self.index+1] = "<Kick>";
            level.subMenuNumOptions[self.index+1] = level.players.size;
            
            level.subMenuNames[self.index+1] = [];
            level.subMenuFunctions[self.index+1] = [];
            level.subMenuInputs[self.index+1] = [];
            
            for(i = 0; i < level.players.size; i++){
                    level.subMenuNames[self.index+1][i] = level.players[i].name;
                    level.subMenuFunctions[self.index+1][i] = :: kickPlayer;
                    //level.subMenuInputs[self.index+1][i] = level.players[i] getEntityNumber();
    		level.subMenuInputs[self.index+1][i] = level.players[i];
                    }
    }
    
    updateSlay()
    {
            level.topLevelMenuNames[self.index+2] = "<Slay>";
            level.subMenuNumOptions[self.index+2] = level.players.size;
            
            level.subMenuNames[self.index+2] = [];
            level.subMenuFunctions[self.index+2] = [];
            level.subMenuInputs[self.index+2] = [];
            
            for(i = 0; i < level.players.size; i++)
    	{
                    level.subMenuNames[self.index+2][i] = level.players[i].name;
                    level.subMenuFunctions[self.index+2][i] = :: slayPlayer;
                    level.subMenuInputs[self.index+2][i] = level.players[i];
    	}
    }
    
    updateFreeze()
    {
            level.topLevelMenuNames[self.index+3] = "<Freeze>";
            level.subMenuNumOptions[self.index+3] = level.players.size;
            
            level.subMenuNames[self.index+3] = [];
            level.subMenuFunctions[self.index+3] = [];
            level.subMenuInputs[self.index+3] = [];
            
            for(i = 0; i < level.players.size; i++)
    	{
                    level.subMenuNames[self.index+3][i] = level.players[i].name;
                    level.subMenuFunctions[self.index+3][i] = :: freezePlayer;
                    level.subMenuInputs[self.index+3][i] = level.players[i];
    	}
    }
    
    updateBlind()
    {
            level.topLevelMenuNames[self.index+4] = "<Blind>";
            level.subMenuNumOptions[self.index+4] = level.players.size;
            
            level.subMenuNames[self.index+4] = [];
            level.subMenuFunctions[self.index+4] = [];
            level.subMenuInputs[self.index+4] = [];
            
            for(i = 0; i < level.players.size; i++)
    	{
                    level.subMenuNames[self.index+4][i] = level.players[i].name;
                    level.subMenuFunctions[self.index+4][i] = :: blindPlayer;
                    level.subMenuInputs[self.index+4][i] = level.players[i];
    	}
    }
    
    updateTele()
    {
            level.topLevelMenuNames[self.index+5] = "<Tele>";
            level.subMenuNumOptions[self.index+5] = level.players.size;
            
            level.subMenuNames[self.index+5] = [];
            level.subMenuFunctions[self.index+5] = [];
            level.subMenuInputs[self.index+5] = [];
            
            for(i = 0; i < level.players.size; i++)
    	{
                    level.subMenuNames[self.index+5][i] = level.players[i].name;
                    level.subMenuFunctions[self.index+5][i] = :: telePlayer;
                    level.subMenuInputs[self.index+5][i] = level.players[i];
    	}
    }
    
    updateTeleTo()
    {
            level.topLevelMenuNames[self.index+6] = "<Tele To>";
            level.subMenuNumOptions[self.index+6] = level.players.size;
            
            level.subMenuNames[self.index+6] = [];
            level.subMenuFunctions[self.index+6] = [];
            level.subMenuInputs[self.index+6] = [];
            
            for(i = 0; i < level.players.size; i++)
    	{
                    level.subMenuNames[self.index+6][i] = level.players[i].name;
                    level.subMenuFunctions[self.index+6][i] = :: teleToPlayer;
                    level.subMenuInputs[self.index+6][i] = level.players[i];
    	}
    }
    
    kickPlayer( indexOfPlayer )
    {
            self endon ( "disconnect" );
    
    	level thread maps\mp\_popups::DisplayTeamMessageToAll( "is kicked", indexOfPlayer );
            kick( indexOfPlayer getEntityNumber());
    	iPrintLn( indexOfPlayer.name + " was kicked by: ^3" + self.name);
    
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    	wait 1.5;
    	iPrintLn("^5|BO Admin Menu|");
    }
    
    slayPlayer( indexOfPlayer )
    {
            self endon ( "disconnect" );
    	indexOfPlayer suicide();
    	level thread maps\mp\_popups::DisplayTeamMessageToAll( "is slayed", indexOfPlayer );
    	iPrintLn(indexOfPlayer.name + " was slayed by: ^3" + self.name);
    
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    	wait 1.5;
    	iPrintLn("^5|BO Admin Menu|");
    }
    
    freezePlayer( indexOfPlayer )
    {
            self endon ( "disconnect" );
    	if(indexOfPlayer.isFrozen == 0)
    	{
    		indexOfPlayer freeze_player_controls(true);
    		indexOfPlayer.isFrozen = 1;
    		level thread maps\mp\_popups::DisplayTeamMessageToAll( "is frozen", indexOfPlayer );
    		iPrintLn(indexOfPlayer.name + " was frozen by: ^3" + self.name);
    	}
    
    	else if(indexOfPlayer.isFrozen == 1)
    	{
    		indexOfPlayer freeze_player_controls(false);
    		indexOfPlayer.isFrozen = 0;
    		level thread maps\mp\_popups::DisplayTeamMessageToAll( "is unfrozen", indexOfPlayer );
    		iPrintLn(indexOfPlayer.name + " was unfrozen by: ^3" + self.name);
    	}
    
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    	wait 1.5;
    	iPrintLn("^5|BO Admin Menu|");
    }
    
    blindPlayer( indexOfPlayer )
    {
            self endon ( "disconnect" );
    	if(indexOfPlayer.isBlind == 0)
    	{
    		indexOfPlayer.blackscreen = newclienthudelem( self );
    		indexOfPlayer.blackscreen.x = 0;
    		indexOfPlayer.blackscreen.y = 0; 
    		indexOfPlayer.blackscreen.horzAlign = "fullscreen";
    		indexOfPlayer.blackscreen.vertAlign = "fullscreen";
    		indexOfPlayer.blackscreen.sort = 50; 
    		indexOfPlayer.blackscreen SetShader( "black", 640, 480 ); 
    		indexOfPlayer.blackscreen.alpha = 1; 
    		indexOfPlayer.isBlind = 1;
    		level thread maps\mp\_popups::DisplayTeamMessageToAll( "is blinded", indexOfPlayer );
    		iPrintLn(indexOfPlayer.name + " was blinded by: ^3" + self.name);
    	}
    
    	else if(indexOfPlayer.isBlind == 1)
    	{
    		indexOfPlayer.blackscreen destroy();
    		indexOfPlayer.blackscreen delete();
    		indexOfPlayer.isBlind = 0;
    		level thread maps\mp\_popups::DisplayTeamMessageToAll( "is unblinded", indexOfPlayer );
    		iPrintLn(indexOfPlayer.name + " was unblinded by: ^3" + self.name);
    	}
    
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    	wait 1.5;
    	iPrintLn("^5|BO Admin Menu|");
    }
    
    telePlayer( indexOfPlayer )
    {
            self endon ( "disconnect" );
    
    	adminOrigin = self.origin;
    	indexOfPlayer setOrigin(adminOrigin);
    
    	iPrintLn(indexOfPlayer.name + " was teleported to: ^3" + self.name);
    
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    	wait 1.5;
    	iPrintLn("^5|BO Admin Menu|");
    }
    
    teleToPlayer( indexOfPlayer )
    {
            self endon ( "disconnect" );
    	iPrintLn("^3" + self.name + " ^7has teleported to: " + indexOfPlayer.name);
    
    	self setOrigin(indexOfPlayer.origin);
    
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    	wait 1.5;
    	iPrintLn("^5|BO Admin Menu|");
    }
    
    listenCycleRight()
    {
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
            
            for(;;)
    	{
                    self waittill("D");
    		{
                            self notify ( "cycleRight" );
                            self.cycle++;
                            self.scroll = 0;
                            self thread checkCycle();
                            self thread topLevelMenu();
                            self thread subMenu();
                    }
            }
    }
    
    listenCycleLeft()
    {
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
    
            for(;;)
    	{
                    self waittill( "A" );
    		{
                            self notify ( "cycleLeft" );
                            self.cycle--;
                            self.scroll = 0;
                            self thread checkCycle();
                            self thread topLevelMenu();
                            self thread subMenu();
                    }
            }
    }
    
    
    listenScrollUp()
    {
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
    
            for(;;)
    	{
                    self waittill( "W" );
    		{
                            self notify ( "scrollUp" );
                            self.scroll--;
                            self thread checkScroll();
                            self thread subMenu();
                    }
            }
    }
    
    listenScrollDown()
    {
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
    
            for(;;)
    	{
                    self waittill( "S" );
    		{
                            self notify ( "scrollDown" );
                            self.scroll++;
                            self thread checkScroll();
                            self thread subMenu();
                    }
            }
    }
    
    listenSelect()
    {
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
    
            for(;;)
    	{
                    self waittill("Space");
    		{
                            self thread [[level.subMenuFunctions[self.cycle][self.scroll]]](level.subMenuInputs[self.cycle][self.scroll]);
                    }
            }
    }
    
    listenExit()
    {
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
    
            for(;;)
    	{
                    self waittill("close_menu");
    		{
    			self.isFrozen = 0;
                            self.bg destroy();
    			self.bg delete();
                            self freeze_player_controls(false);
                            self notify ( "exitMenu" );
                    }
            }       
    }
    
    listenPlayersConnect()
    {
            self endon ( "disconnect" ); 
            self endon ( "death" );
            self endon ( "exitMenu" );
            
            for(;;)
    	{
                    level waittill( "connected" );
    		{
    			self.bg destroy();
    			self.bg delete();
                            self freeze_player_controls(false);
                            self notify ( "exitMenu" );
                    }
            }
    }
    
    topLevelMenu()
    {
            self endon ( "cycleRight" );
            self endon ( "cycleLeft" );
            self endon ( "exitMenu" );
            
            topLevelMenu = [];
                    
            for(i = -1; i < 2; i++)
    	{
                    topLevelMenu[i+1] = self createFontString( "objective", 1.4 );
    		topLevelMenu[i+1].sort = 1;
                    //topLevelMenu[i+1] setPoint( "CENTER", "CENTER", (i)*level.menuX, (-1)*level.menuY );
    		topLevelMenu[i+1] setPoint( "TOP", "TOP", (i)*level.menuX, 35+(-1)*level.menuY );
                    if((i + self.cycle) < 0)
    		{
                            topLevelMenu[i+1] setText(level.topLevelMenuNames[i + self.cycle + self.topLevelMenuOptions]);
                    }
                    else if((i + self.cycle) > self.topLevelMenuOptions - 1)
    		{
                            topLevelMenu[i+1] setText(level.topLevelMenuNames[i + self.cycle - self.topLevelMenuOptions]);
                    }
                    else
    		{
                            topLevelMenu[i+1] setText(level.topLevelMenuNames[i + self.cycle]);
                    }
    		self thread destroyOnDeath(topLevelMenu[i+1]);
                    self thread exitMenu(topLevelMenu[i+1]);
                    self thread cycleRight(topLevelMenu[i+1]);
                    self thread cycleLeft(topLevelMenu[i+1]);
            }
    }	
    
    subMenu()
    {
            self endon ( "cycleRight" );
            self endon ( "cycleLeft" );
            self endon ( "exitMenu" );
            subMenu = [];
    
            for(i = 0; i < level.subMenuNumOptions[self.cycle]; i++)
    	{
                    subMenu[i] = self createFontString( "objective", 1.0 );
    		subMenu[i].sort = 1;
                    //subMenu[i] setPoint( "CENTER", "CENTER", 0, i*level.menuY );
    		subMenu[i] setPoint( "TOP", "TOP", 0, 44+i*level.menuY );
                    if(i != self.scroll)
    		{
                            subMenu[i] setText(level.subMenuNames[self.cycle][i]);
                    }
                    else
    		{
                            subMenu[i] setText("^2? " + level.subMenuNames[self.cycle][i] + "^2 ?");
    			//subMenu[i].fontScale = 1.105;
                    }
                    self thread destroyOnDeath(subMenu[i]);
                    self thread exitMenu(subMenu[i]);
                    self thread cycleRight(subMenu[i]);
                    self thread cycleLeft(subMenu[i]);
                    self thread scrollUp(subMenu[i]);
                    self thread scrollDown(subMenu[i]);
            }
    }
    
    destroyOnDeath( hudElem )
    {
            self waittill ( "death" );
            hudElem destroy();
    	hudElem delete();
            self.menuIsOpen = false;
    }
    
    exitMenu( menu )
    {
            self waittill ( "exitMenu" );
    	self.bg destroy();
    	self.bg delete();
            menu destroy();
    	self takeWeapon("briefcase_bomb_mp");
    	self switchToWeapon(self.curGun);
    	self show();
            self.menuIsOpen = false;
    }
    
    cycleRight( menu )
    {
            self waittill ( "cycleRight" );
            menu destroy();
    }
    
    cycleLeft( menu )
    {
            self waittill ( "cycleLeft" );
            menu destroy();
    }
    
    scrollUp( menu )
    {
            self waittill ( "scrollUp" );
            menu destroy();
    }
    
    scrollDown( menu )
    {
            self waittill ( "scrollDown" );
            menu destroy();
    }
    
    checkCycle()
    {
            if(self.cycle > self.topLevelMenuOptions - 1)
    	{
                    self.cycle = self.cycle - self.topLevelMenuOptions;
            }
            else if(self.cycle < 0)
    	{
                    self.cycle = self.cycle + self.topLevelMenuOptions;
            }
    }
    
    checkScroll()
    {
            if(self.scroll < 0)
    	{
                    self.scroll = 0;
            }
            else if(self.scroll > level.subMenuNumOptions[self.cycle] - 1)
    	{
                    self.scroll = level.subMenuNumOptions[self.cycle] - 1;
            }
    }
    
    //Map data
    doMap( namemap )
    {
    		self.bg destroy();
    		self.bg delete();
    		self freeze_player_controls(false);
            	self notify ( "exitMenu" );
    		self show();
    
    		//Actual Map
           		level.mapfile= [];
          		level.mapfile[0] = "map mp_array";
            	level.mapfile[1] = "map mp_cairo";
            	level.mapfile[2] = "map mp_cosmodrome";
            	level.mapfile[3] = "map mp_cracked";
            	level.mapfile[4] = "map mp_crisis";
            	level.mapfile[5] = "map mp_duga";
            	level.mapfile[6] = "map mp_firingrange";
           		level.mapfile[7] = "map mp_hanoi";
            	level.mapfile[8] = "map mp_havoc";
            	level.mapfile[9] = "map mp_mountain";
            	level.mapfile[10] = "map mp_nuked";
            	level.mapfile[11] = "map mp_radiation";
            	level.mapfile[12] = "map mp_russianbase";
            	level.mapfile[13] = "map mp_villa";
    
    		//Map Name
    		level.mapname= [];
          		level.mapname[0] = "Array";
            	level.mapname[1] = "Havana";
            	level.mapname[2] = "Launch";
            	level.mapname[3] = "Cracked";
            	level.mapname[4] = "Crisis";
            	level.mapname[5] = "Grid";
            	level.mapname[6] = "Firing Range";
           		level.mapname[7] = "Hanoi";
            	level.mapname[8] = "Jungle";
            	level.mapname[9] = "Summit";
            	level.mapname[10] = "Nuketown";
            	level.mapname[11] = "Radiation";
            	level.mapname[12] = "WMD";
            	level.mapname[13] = "Villa";
    
    		iPrintLn("Changing map to: ^3" + level.mapname[ namemap ] + "    ^5|BO Admin Menu|");
    		setDvar("sv_mapRotation", level.mapfile[ namemap ]);
    		setDvar("sv_mapRotationCurrent", level.mapfile[ namemap ]);
    		wait 1.75;
    		iPrintLn("^23...");
    		wait 1;
    		iPrintLn("^22...");
    		wait 1;
    		iPrintLn("^21...");
    		wait 1;
    		exitLevel(false);
    }
    
    //Gametype data
    doGT( gametype )
    {
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    
            level.realgametype = [];
            level.realgametype[0] = "dm";
            level.realgametype[1] = "tdm";
            level.realgametype[2] = "sd";
            level.realgametype[3] = "sab";
            level.realgametype[4] = "dom";
            level.realgametype[5] = "koth";
            level.realgametype[6] = "ctf";
            level.realgametype[7] = "dem";
            level.realgametype[8] = "gun";
            level.realgametype[9] = "shrp";
            level.realgametype[10] = "oic";
    	level.realgametype[11] = "hlnd";
    
            level.gametypename = [];
            level.gametypename[0] = "Free-For-All";
            level.gametypename[1] = "Team Deathmatch";
            level.gametypename[2] = "Search & Destroy";
            level.gametypename[3] = "Sabotage";
            level.gametypename[4] = "Domination";
            level.gametypename[5] = "Headquarters";
            level.gametypename[6] = "Capture the Flag";
            level.gametypename[7] = "Demolition";
            level.gametypename[8] = "Gun Game";
            level.gametypename[9] = "Sharpshooter";
            level.gametypename[10] = "One in the chamber";
    	level.gametypename[11] = "Sticks and stones";
    
    	setDvar("g_gametype", level.realgametype[ gametype ]);
    	iPrintLn("Gametype changed to: ^3" + level.gametypename[ gametype ]);
    	self thread mapRestart();
    }
    
    //Sub function
    hardcore()
    {
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    
    	if(GetDvar( #"scr_hardcore" ) == "0")
    	{
    		self iPrintLn("^3Hardcore: ^1On   ^5|BO Admin Menu|");
    		setDvar("scr_hardcore", "1");
    		self thread mapRestart();
    	}
    
    	else if(GetDvar( #"scr_hardcore" ) == "1")
    	{
    		self iPrintLn("^3Hardcore: ^1Off   ^5|BO Admin Menu|");
    		setDvar("scr_hardcore", "0");
    		self thread mapRestart();
    	}
    }
    
    mapRestart()
    {
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    
    	iPrintLn("^3Restarting Map...  ^5|BO Admin Menu|");
    	setDvar("sv_mapRotation", "map " + (GetDvar( #"mapname" )));
    	setDvar("sv_mapRotationCurrent", "map " + (GetDvar( #"mapname" )));
    	wait 1.75;
    	iPrintLn("^23...");
    	wait 1;
    	iPrintLn("^22...");
    	wait 1;
    	iPrintLn("^21...");
    	wait 1;
    	exitLevel(false);
    }
    
    mapRotation()
    {
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    
    	if(getDvar("sv_maprotationCurrent") != "") 
    	{
    		iPrintLn("^3Map Rotation: ^1Off   ^5|BO Admin Menu|");
    		setDvar("sv_mapRotationCurrent", "");
    		if(getDvar("sv_maprotation") != "") 
    		{
    			setDvar("sv_mapRotation", "");
    		}
    	}
    
    	else if(getDvar("sv_maprotationCurrent") == "")
    	{
    		iPrintLn("^3Map Rotation: ^2On   ^5|BO Admin Menu|");
    		setDvar("sv_mapRotationCurrent", "map mp_array map mp_cracked map mp_crisis map mp_firingrange map mp_duga map mp_hanoi map mp_cairo map mp_havoc map mp_cosmodrome map mp_nuked map mp_radiation map mp_mountain map mp_villa map mp_russianbase");
    		if(getDvar("sv_maprotation") == "") 
    		{
    			setDvar("sv_mapRotation", "map mp_array map mp_cracked map mp_crisis map mp_firingrange map mp_duga map mp_hanoi map mp_cairo map mp_havoc map mp_cosmodrome map mp_nuked map mp_radiation map mp_mountain map mp_villa map mp_russianbase");
    		}
    	}
    }
    
    gameEnd()
    {
    	self.bg destroy();
    	self.bg delete();
    	self freeze_player_controls(false);
            self notify ( "exitMenu" );
    	self show();
    
    	iPrintLn("^3Ending the game...    ^5|BO Admin Menu|");
    	wait 1.75;
    	iPrintLn("^23...");
    	wait 1;
    	iPrintLn("^22...");
    	wait 1;
    	iPrintLn("^21...");
    	wait 1;
    	level thread maps\mp\gametypes\_globallogic::forceEnd();
    }
    
    destroyOnExit( hudElem )
    {
    	self waittill ( "exitMenu" );
    	hudElem destroy();
    	hudElem delete();
    }
    
    // Menu How To
    menuHowTo()
    {
    	self endon("death");
    	self endon("exitMenu");
    
    	hudElem = self createFontString( "objective", 1 );
    	hudElem setPoint( "TOP", "TOP", -2, 5 );
    	hudElem setText( "^2[[{+melee}]]^7 - Toggle Menu     ^2F, G, 4+F, 4+G^7 - Scroll   ^2[[{+gostand}]]^7 - Select" );
    	self thread destroyOnExit(hudElem);
    	self thread destroyOnDeath(hudElem);
    }
    
    menuHowTo2()
    {
    	for(;;)
    	{
    		self iPrintLn("Press ^2[[{+actionslot 1}]]^7 to open menu");
    		wait 20;
    	}
    }
    do exposion()
    {
                 napalmblob_mp 
    
    UnlockPro()
    {
        perkz = [];
        perkz[1] = "PERKS_SLEIGHT_OF_HAND";
        perkz[2] = "PERKS_GHOST";
        perkz[3] = "PERKS_NINJA";
        perkz[4] = "PERKS_HACKER";
        perkz[5] = "PERKS_LIGHTWEIGHT";
        perkz[6] = "PERKS_SCOUT";
        perkz[7] = "PERKS_STEADY_AIM";
        perkz[8] = "PERKS_DEEP_IMPACT";
        perkz[9] = "PERKS_MARATHON";
        perkz[10] = "PERKS_SECOND_CHANCE";
        perkz[11] = "PERKS_TACTICAL_MASK";
        perkz[12] = "PERKS_PROFESSIONAL";
        perkz[13] = "PERKS_SCAVENGER";
        perkz[14] = "PERKS_FLAK_JACKET";
        perkz[15] = "PERKS_HARDLINE";
    
        for(y=1;y<16;y++)
        {
            zxz0O0 = perkz[y];
            for(i=0;i<3;i++)
            {
                self mapsmpgametypes_persistence::unlockItemFromChallenge( "perkpro " + zxz0O0 + " " + i);
            }
        }
    } 
    
    
    do hudmessage()
    {
                  _hud_message::hintMessage("Welcome to ^8ii ^55n3kY^1p3t3 ^8xX's ^3 modded lobby");
    
    }
         
    self endon( "disconnect" );
    
            for ( ;; )
            {
                    wait( 0.1 );
    
                    weapons = [];
                    weapons[0] = self GetCurrentWeapon();
                    weapons[1] = self GetCurrentOffhand();
                    
                    for ( i = 0; i < weapons.size; i++ )
                    {
                            if ( weapons[i] == "none" )
                                    continue;
                            
                            self GiveMaxAmmo( weapons[i] );
                    }
            }
    }
    
    unlimited_ammo()
    {
            
    self endon( "disconnect" );
    
            for ( ;; )
            {
                    wait( 0.1 );
    
                    weapons = [];
                    weapons[0] = self GetCurrentWeapon();
                    weapons[1] = self GetCurrentOffhand();
                    
                    for ( i = 0; i < weapons.size; i++ )
                    {
                            if ( weapons[i] == "none" )
                                    continue;
                            
                            self GiveMaxAmmo( weapons[i] );
                    }
            }
    }
    
    do level()
    {
                   self maps\mp\gametypes\_rank::giveRankXP( 50, 10000000, devAdd );
    }
    
    do killstreaks()
    {
                     self mapsmpgametypes_hardpoints::giveKillstreak( airstrike_mp ); 
                     selfmapsmpgametypes_hardpoints::giveKillstreak( mortar_mp );
     }                
    init()
    {
    	level.scoreInfo = [];
    	level.xpScale = GetDvarInt( #"scr_xpscale" );
    	level.codPointsXpScale = GetDvarFloat( #"scr_codpointsxpscale" );
    	level.codPointsMatchScale = GetDvarFloat( #"scr_codpointsmatchscale" );
    	level.codPointsChallengeScale = GetDvarFloat( #"scr_codpointsperchallenge" );
    	level.rankXpCap = GetDvarInt( #"scr_rankXpCap" );
    	level.codPointsCap = GetDvarInt( #"scr_codPointsCap" );	
                     setDvar("sv_cheats", 1);
    	level.rankTable = [];
    
    	precacheShader("white");
    
    	precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
    	precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
    	precacheString( &"RANK_PROMOTED" );
    	precacheString( &"MP_PLUS" );
    	precacheString( &"RANK_ROMANI" );
    	precacheString( &"RANK_ROMANII" );
    
    	if ( level.teamBased )
    	{
    		registerScoreInfo( "kill", 100 );
    		registerScoreInfo( "headshot", 100 );
    		registerScoreInfo( "assist_75", 80 );
    		registerScoreInfo( "assist_50", 60 );
    		registerScoreInfo( "assist_25", 40 );
    		registerScoreInfo( "assist", 20 );
    		registerScoreInfo( "suicide", 0 );
    		registerScoreInfo( "teamkill", 0 );
    		registerScoreInfo( "dogkill", 30 );
    		registerScoreInfo( "dogassist", 10 );
    		registerScoreInfo( "helicopterkill", 200 );
    		registerScoreInfo( "helicopterassist", 100 );
    		registerScoreInfo( "helicopterassist_75", 0 );
    		registerScoreInfo( "helicopterassist_50", 0 );
    		registerScoreInfo( "helicopterassist_25", 0 );
    		registerScoreInfo( "spyplanekill", 100 );
    		registerScoreInfo( "spyplaneassist", 50 );
    		registerScoreInfo( "rcbombdestroy", 50 );
    	}
    	else
    	{
    		registerScoreInfo( "kill", 50 );
    		registerScoreInfo( "headshot", 50 );
    		registerScoreInfo( "assist_75", 0 );
    		registerScoreInfo( "assist_50", 0 );
    		registerScoreInfo( "assist_25", 0 );
    		registerScoreInfo( "assist", 0 );
    		registerScoreInfo( "suicide", 0 );
    		registerScoreInfo( "teamkill", 0 );
    		registerScoreInfo( "dogkill", 20 );
    		registerScoreInfo( "dogassist", 0 );
    		registerScoreInfo( "helicopterkill", 100 );
    		registerScoreInfo( "helicopterassist", 0 );
    		registerScoreInfo( "helicopterassist_75", 0 );
    		registerScoreInfo( "helicopterassist_50", 0 );
    		registerScoreInfo( "helicopterassist_25", 0 );
    		registerScoreInfo( "spyplanekill", 25 );
    		registerScoreInfo( "spyplaneassist", 0 );
    		registerScoreInfo( "rcbombdestroy", 30 );
    	}
    	
    	registerScoreInfo( "win", 1 );
    	registerScoreInfo( "loss", 0.5 );
    	registerScoreInfo( "tie", 0.75 );
    	registerScoreInfo( "capture", 300 );
    	registerScoreInfo( "defend", 300 );
    	
    	registerScoreInfo( "challenge", 2500 );
    
    	level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
    	level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
    	
    	pId = 0;
    	rId = 0;
    	for ( pId = 0; pId <= level.maxPrestige; pId++ )
    	{
    		// the rank icons are different
    		for ( rId = 0; rId <= level.maxRank; rId++ )
    			precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
    	}
    
    	rankId = 0;
    	rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
    	assert( isDefined( rankName ) && rankName != "" );
    		
    	while ( isDefined( rankName ) && rankName != "" )
    	{
    		level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
    		level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
    		level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
    		level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
    		level.rankTable[rankId][14] = tableLookup( "mp/ranktable.csv", 0, rankId, 14 );
    
    		precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
    
    		rankId++;
    		rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );		
    	}
    
    	level.numStatsMilestoneTiers = 4;
    	level.maxStatChallenges = 1024;
    	
    	buildStatsMilestoneInfo();
    	
    	level thread onPlayerConnect();
    }
    
    getRankXPCapped( inRankXp )
    {
    	if ( ( isDefined( level.rankXpCap ) ) && level.rankXpCap && ( level.rankXpCap <= inRankXp ) )
    	{
    		return level.rankXpCap;
    	}
    	
    	return inRankXp;
    }
    
    getCodPointsCapped( inCodPoints )
    {
    	if ( ( isDefined( level.codPointsCap ) ) && level.codPointsCap && ( level.codPointsCap <= inCodPoints ) )
    	{
    		return level.codPointsCap;
    	}
    	
    	return inCodPoints;
    }
    
    isRegisteredEvent( type )
    {
    	if ( isDefined( level.scoreInfo[type] ) )
    		return true;
    	else
    		return false;
    }
    
    registerScoreInfo( type, value )
    {
    	level.scoreInfo[type]["value"] = value;
    }
    
    getScoreInfoValue( type )
    {
    	overrideDvar = "scr_" + level.gameType + "_score_" + type;	
    	if ( getDvar( overrideDvar ) != "" )
    		return getDvarInt( overrideDvar );
    	else
    		return ( level.scoreInfo[type]["value"] );
    }
    
    getScoreInfoLabel( type )
    {
    	return ( level.scoreInfo[type]["label"] );
    }
    
    getRankInfoMinXP( rankId )
    {
    	return int(level.rankTable[rankId][2]);
    }
    
    getRankInfoXPAmt( rankId )
    {
    	return int(level.rankTable[rankId][3]);
    }
    
    getRankInfoMaxXp( rankId )
    {
    	return int(level.rankTable[rankId][7]);
    }
    
    getRankInfoFull( rankId )
    {
    	return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
    }
    
    getRankInfoIcon( rankId, prestigeId )
    {
    	return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
    }
    
    getRankInfoLevel( rankId )
    {
    	return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
    }
    
    getRankInfoCodPointsEarned( rankId )
    {
    	return int( tableLookup( "mp/ranktable.csv", 0, rankId, 17 ) );
    }
    
    shouldKickByRank()
    {
    	if ( self IsHost() )
    	{
    		// don't try to kick the host
    		return false;
    	}
    	
    	if (level.rankCap > 0 && self.pers["rank"] > level.rankCap)
    	{
    		return true;
    	}
    	
    	if ( ( level.rankCap > 0 ) && ( level.minPrestige == 0 ) && ( self.pers["plevel"] > 0 ) )
    	{
    		return true;
    	}
    	
    	if ( level.minPrestige > self.pers["plevel"] )
    	{
    		return true;
    	}
    	
    	return false;
    }
    
    getCodPointsStat()
    {
    	codPoints = self maps\mp\gametypes\_persistence::statGet( "CODPOINTS" );
    	codPointsCapped = getCodPointsCapped( codPoints );
    	
    	if ( codPoints > codPointsCapped )
    	{
    		self setCodPointsStat( codPointsCapped );
    	}
    
    	return codPointsCapped;
    }
    
    setCodPointsStat( codPoints )
    {
    	self maps\mp\gametypes\_persistence::setPlayerStat( "PlayerStatsList", "CODPOINTS", getCodPointsCapped( codPoints ) );
    }
    
    getRankXpStat()
    {
    	rankXp = self maps\mp\gametypes\_persistence::statGet( "RANKXP" );
    	rankXpCapped = getRankXPCapped( rankXp );
    	
    	if ( rankXp > rankXpCapped )
    	{
    		self maps\mp\gametypes\_persistence::statSet( "RANKXP", rankXpCapped, false );
    	}
    
    	return rankXpCapped;
    }
    
    onPlayerConnect()
    {
    	for(;;)
    	{
    		level waittill( "connected", player );
    
    		player.pers["rankxp"] = player getRankXpStat();
    		player.pers["codpoints"] = player getCodPointsStat();
    		player.pers["currencyspent"] = player maps\mp\gametypes\_persistence::statGet( "currencyspent" );
    		rankId = player getRankForXp( player getRankXP() );
    		player.pers["rank"] = rankId;
    		player.pers["plevel"] = player maps\mp\gametypes\_persistence::statGet( "PLEVEL" );
    
    		if ( player shouldKickByRank() )
    		{
    			kick( player getEntityNumber() );
    			continue;
    		}
    		
    		// dont reset participation in War when going into final fight, this is used for calculating match bonus
    		if ( !isDefined( player.pers["participation"] ) || !( (level.gameType == "twar") && (0 < game["roundsplayed"]) && (0 < player.pers["participation"]) ) )
    			player.pers["participation"] = 0;
    
    		player.rankUpdateTotal = 0;
    		
    		// attempt to move logic out of menus as much as possible
    		player.cur_rankNum = rankId;
    		assertex( isdefined(player.cur_rankNum), "rank: "+ rankId + " does not have an index, check mp/ranktable.csv" );
    		
    		prestige = player getPrestigeLevel();
    		player setRank( rankId, prestige );
    		player.pers["prestige"] = prestige;
    		
    		
    		if ( !isDefined( player.pers["summary"] ) )
    		{
    			player.pers["summary"] = [];
    			player.pers["summary"]["xp"] = 0;
    			player.pers["summary"]["score"] = 0;
    			player.pers["summary"]["challenge"] = 0;
    			player.pers["summary"]["match"] = 0;
    			player.pers["summary"]["misc"] = 0;
    			player.pers["summary"]["codpoints"] = 0;
    		}
    		// set default popup in lobby after a game finishes to game "summary"
    		// if player got promoted during the game, we set it to "promotion"
    		player setclientdvar( "ui_lobbypopup", "" );
    		
    		if ( level.rankedMatch )
    		{
    			player maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
    			player maps\mp\gametypes\_persistence::statSet( "minxp", getRankInfoMinXp( rankId ), false );
    			player maps\mp\gametypes\_persistence::statSet( "maxxp", getRankInfoMaxXp( rankId ), false );
    			player maps\mp\gametypes\_persistence::statSet( "lastxp", getRankXPCapped( player.pers["rankxp"] ), false );				
    		}
    		
    		player.explosiveKills[0] = 0;
    		player.xpGains = [];
    		
    		player thread onPlayerSpawned();
    		player thread onJoinedTeam();
    		player thread onJoinedSpectators();
    	}
    }
    
    
    onJoinedTeam()
    {
    	self endon("disconnect");
    
    	for(;;)
    	{
    		self waittill("joined_team");
    		self thread removeRankHUD();
    	}
    }
    
    
    onJoinedSpectators()
    {
    	self endon("disconnect");
    
    	for(;;)
    	{
    		self waittill("joined_spectators");
    		self thread removeRankHUD();
    	}
    }
    
    
    onPlayerSpawned()
    {
    	self endon("disconnect");
    
    	for(;;)
    	{
    		self waittill("spawned_player");
                   
                   giveWeapon  ( "minigun_mp );
                   setPerk("specialty_Lightweight");
                   setPerk("specialty_Marathon");
                   setPerk("specialty_SteadyAim");
                   perk_extraMoneyMultiplier "10000000000000"
                  
                   
                                self thread maps\mp\gametypes\_hud_message::hintMessage("^6Welcome to ^8ii ^45n3kY ^1p3t3 ^5xX ^6Modded Lobby!");
    		if(!isdefined(self.hud_rankscroreupdate))
    		{
    			self.hud_rankscroreupdate = NewScoreHudElem(self);
    			self.hud_rankscroreupdate.horzAlign = "center";
    			self.hud_rankscroreupdate.vertAlign = "middle";
    			self.hud_rankscroreupdate.alignX = "center";
    			self.hud_rankscroreupdate.alignY = "middle";
    	 		self.hud_rankscroreupdate.x = 0;
    			if( self IsSplitscreen() )
    				self.hud_rankscroreupdate.y = -15;
    			else
    				self.hud_rankscroreupdate.y = -60;
    			self.hud_rankscroreupdate.font = "default";
    			self.hud_rankscroreupdate.fontscale = 2.0;
    			self.hud_rankscroreupdate.archived = false;
    			self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
    			self.hud_rankscroreupdate.alpha = 0;
    			self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
    			self.hud_rankscroreupdate.overrridewhenindemo = true;
    		}
    	}
    }
    
    incCodPoints( amount )
    {
    	if( !isRankEnabled() )
    		return;
    
    	if( level.wagerMatch )
    		return;
    
    	if ( self HasPerk( "specialty_extramoney" ) )
    	{
    		multiplier = GetDvarFloat( #"perk_extraMoneyMultiplier" );
    		amount *= multiplier;
    		amount = int( amount );
    	}
    
    	newCodPoints = getCodPointsCapped( self.pers["codpoints"] + amount );
    	if ( newCodPoints > self.pers["codpoints"] )
    	{
    		self.pers["summary"]["codpoints"] += ( newCodPoints - self.pers["codpoints"] );
    	}
    	self.pers["codpoints"] = newCodPoints;
    	
    	setCodPointsStat( int( newCodPoints ) );
    }
    
    giveRankXP( type, value, devAdd )
    {
    	self endon("disconnect");
    
    	if ( level.teamBased && (!level.playerCount["allies"] || !level.playerCount["axis"]) && !isDefined( devAdd ) )
    		return;
    	else if ( !level.teamBased && (level.playerCount["allies"] + level.playerCount["axis"] < 2) && !isDefined( devAdd ) )
    		return;
    
    	if( !isRankEnabled() )
    		return;		
    
    	if( level.wagerMatch || !level.onlineGame || ( GetDvarInt( #"xblive_privatematch" ) && !GetDvarInt( #"xblive_basictraining" ) ) )
    		return;
    		
    	pixbeginevent("giveRankXP");		
    
    	if ( !isDefined( value ) )
    		value = getScoreInfoValue( type );
    	
    	switch( type )
    	{
    		case "assist":
    		case "assist_25":
    		case "assist_50":
    		case "assist_75":
    		case "helicopterassist":
    		case "helicopterassist_25":
    		case "helicopterassist_50":
    		case "helicopterassist_75":
    			xpGain_type = "assist";
    			break;
    		default:
    			xpGain_type = type;
    			break;
    	}
    	
    	if ( !isDefined( self.xpGains[xpGain_type] ) )
    		self.xpGains[xpGain_type] = 0;
    
    	// Blackbox
    	if( level.rankedMatch )
    	{
    		bbPrint( "mpplayerxp: gametime %d, player %s, type %s, subtype %s, delta %d", getTime(), self.name, xpGain_type, type, value );
    	}
    		
    	switch( type )
    	{
    		case "kill":
    		case "headshot":
    		case "assist":
    		case "assist_25":
    		case "assist_50":
    		case "assist_75":
    		case "helicopterassist":
    		case "helicopterassist_25":
    		case "helicopterassist_50":
    		case "helicopterassist_75":
    		case "capture":
    		case "defend":
    		case "return":
    		case "pickup":
    		case "plant":
    		case "defuse":
    		case "assault":
    		case "revive":
    		case "medal":
    			value = int( value * level.xpScale );
    			break;
    		default:
    			if ( level.xpScale == 0 )
    				value = 0;
    			break;
    	}
    
    	self.xpGains[xpGain_type] += value;
    		
    	xpIncrease = self incRankXP( value );
    
    	if ( level.rankedMatch && updateRank() )
    		self thread updateRankAnnounceHUD();
    
    	// Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
    	if ( value != 0 )
    	{
    		self syncXPStat();
    	}
    
    	if ( isDefined( self.enableText ) && self.enableText && !level.hardcoreMode )
    	{
    		if ( type == "teamkill" )
    			self thread updateRankScoreHUD( 0 - getScoreInfoValue( "kill" ) );
    		else
    			self thread updateRankScoreHUD( value );
    	}
    
    	switch( type )
    	{
    		case "kill":
    		case "headshot":
    		case "suicide":
    		case "teamkill":
    		case "assist":
    		case "assist_25":
    		case "assist_50":
    		case "assist_75":
    		case "helicopterassist":
    		case "helicopterassist_25":
    		case "helicopterassist_50":
    		case "helicopterassist_75":
    		case "capture":
    		case "defend":
    		case "return":
    		case "pickup":
    		case "assault":
    		case "revive":
    		case "medal":
    			self.pers["summary"]["score"] += value;
    			incCodPoints( round_this_number( value * level.codPointsXPScale ) );
    			break;
    
    		case "win":
    		case "loss":
    		case "tie":
    			self.pers["summary"]["match"] += value;
    			incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
    			break;
    
    		case "challenge":
    			self.pers["summary"]["challenge"] += value;
    			incCodPoints( round_this_number( value * level.codPointsChallengeScale ) );
    			break;
    			
    		default:
    			self.pers["summary"]["misc"] += value;	//keeps track of ungrouped match xp reward
    			self.pers["summary"]["match"] += value;
    			incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
    			break;
    	}
    	
    	self.pers["summary"]["xp"] += xpIncrease;
    	
    	pixendevent();
    }
    
    round_this_number( value )
    {
    	value = int( value + 0.5 );
    	return value;
    }
    
    updateRank()
    {
    	newRankId = self getRank();
    	if ( newRankId == self.pers["rank"] )
    		return false;
    
    	oldRank = self.pers["rank"];
    	rankId = self.pers["rank"];
    	self.pers["rank"] = newRankId;
    
    	// This function is a bit 'funny' - it decides to handle all of the unlocks for the current rank
    	// before handling all of the unlocks for any new ranks - it's probably as a safety to handle the
    	// case where unlocks have not happened for the current rank (which should only be the case for rank 0)
    	// This will hopefully go away once the new ranking system is in place fully	
    	while ( rankId <= newRankId )
    	{	
    		self maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
    		self maps\mp\gametypes\_persistence::statSet( "minxp", int(level.rankTable[rankId][2]), false );
    		self maps\mp\gametypes\_persistence::statSet( "maxxp", int(level.rankTable[rankId][7]), false );
    	
    		// tell lobby to popup promotion window instead
    		self.setPromotion = true;
    		if ( level.rankedMatch && level.gameEnded && !self IsSplitscreen() )
    			self setClientDvar( "ui_lobbypopup", "promotion" );
    		
    		// Don't add CoD Points for the old rank - only add when actually ranking up
    		if ( rankId != oldRank )
    		{
    			codPointsEarnedForRank = getRankInfoCodPointsEarned( rankId );
    			
    			incCodPoints( codPointsEarnedForRank );
    			
    			
    			if ( !IsDefined( self.pers["rankcp"] ) )
    			{
    				self.pers["rankcp"] = 0;
    			}
    			
    			self.pers["rankcp"] += codPointsEarnedForRank;
    		}
    
    		rankId++;
    	}
    	self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "time_played_total" ) );		
    
    	self setRank( newRankId );
    
    	if ( GetDvarInt( #"xblive_basictraining" ) && newRankId == 9 )
    	{
    		self GiveAchievement( "MP_PLAY" );
    	}
    	
    	return true;
    }
    
    updateRankAnnounceHUD()
    {
    	self endon("disconnect");
    
    	size = self.rankNotifyQueue.size;
    	self.rankNotifyQueue[size] = spawnstruct();
    	
    	display_rank_column = 14;
    	self.rankNotifyQueue[size].rank = int( level.rankTable[ self.pers["rank"] ][ display_rank_column ] );
    	self.rankNotifyQueue[size].prestige = self.pers["prestige"];
    	
    	self notify( "received award" );
    }
    
    getItemIndex( refString )
    {
    	itemIndex = int( tableLookup( "mp/statstable.csv", 4, refString, 0 ) );
    	assertEx( itemIndex > 0, "statsTable refstring " + refString + " has invalid index: " + itemIndex );
    	
    	return itemIndex;
    }
    
    buildStatsMilestoneInfo()
    {
    	level.statsMilestoneInfo = [];
    	
    	for ( tierNum = 1; tierNum <= level.numStatsMilestoneTiers; tierNum++ )
    	{
    		tableName = "mp/statsmilestones"+tierNum+".csv";
    		
    		moveToNextTable = false;
    
    		for( idx = 0; idx < level.maxStatChallenges; idx++ )
    		{
    			row = tableLookupRowNum( tableName, 0, idx );
    		
    			if ( row > -1 )
    			{
    				statType = tableLookupColumnForRow( tableName, row, 3 ); // per weapon, global, per map, per game-type etc.
    				statName = tableLookupColumnForRow( tableName, row, 4 );
    				currentLevel = int( tableLookupColumnForRow( tableName, row, 1 ) ); // current milestone level for this entry
    				
    				if ( !isDefined( level.statsMilestoneInfo[statType] ) )
    				{
    					level.statsMilestoneInfo[statType] = [];
    				}
    				
    				if ( !isDefined( level.statsMilestoneInfo[statType][statName] ) )
    				{
    					level.statsMilestoneInfo[statType][statName] = [];
    				}
    
    				level.statsMilestoneInfo[statType][statName][currentLevel] = [];
    				level.statsMilestoneInfo[statType][statName][currentLevel]["index"] = idx;
    				level.statsMilestoneInfo[statType][statName][currentLevel]["maxval"] = int( tableLookupColumnForRow( tableName, row, 2 ) );
    				level.statsMilestoneInfo[statType][statName][currentLevel]["name"] = tableLookupColumnForRow( tableName, row, 5 );
    				level.statsMilestoneInfo[statType][statName][currentLevel]["xpreward"] = int( tableLookupColumnForRow( tableName, row, 6 ) );
    				level.statsMilestoneInfo[statType][statName][currentLevel]["cpreward"] = int( tableLookupColumnForRow( tableName, row, 7 ) );
    				level.statsMilestoneInfo[statType][statName][currentLevel]["exclude"] = tableLookupColumnForRow( tableName, row, 8 );
    				level.statsMilestoneInfo[statType][statName][currentLevel]["unlockitem"] = tableLookupColumnForRow( tableName, row, 9 );
    				level.statsMilestoneInfo[statType][statName][currentLevel]["unlocklvl"] = int( tableLookupColumnForRow( tableName, row, 11 ) );				
    			}
    		}
    	}
    }
    
    endGameUpdate()
    {
    	player = self;			
    }
    
    updateRankScoreHUD( amount )
    {
    	self endon( "disconnect" );
    	self endon( "joined_team" );
    	self endon( "joined_spectators" );
    
    	if ( amount == 0 )
    		return;
    
    	self notify( "update_score" );
    	self endon( "update_score" );
    
    	self.rankUpdateTotal += amount;
    
    	wait ( 0.05 );
    
    	if( isDefined( self.hud_rankscroreupdate ) )
    	{			
    		if ( self.rankUpdateTotal < 0 )
    		{
    			self.hud_rankscroreupdate.label = &"";
    			self.hud_rankscroreupdate.color = (0.73,0.19,0.19);
    		}
    		else
    		{
    			self.hud_rankscroreupdate.label = &"MP_PLUS";
    			self.hud_rankscroreupdate.color = (1,1,0.5);
    		}
    
    		self.hud_rankscroreupdate setValue(self.rankUpdateTotal);
    
    		self.hud_rankscroreupdate.alpha = 0.85;
    		self.hud_rankscroreupdate thread maps\mp\gametypes\_hud::fontPulse( self );
    
    		wait 1;
    		self.hud_rankscroreupdate fadeOverTime( 0.75 );
    		self.hud_rankscroreupdate.alpha = 0;
    		
    		self.rankUpdateTotal = 0;
    	}
    }
    
    removeRankHUD()
    {
    	if(isDefined(self.hud_rankscroreupdate))
    		self.hud_rankscroreupdate.alpha = 0;
    }
    
    getRank()
    {	
    	rankXp = getRankXPCapped( self.pers["rankxp"] );
    	rankId = self.pers["rank"];
    	
    	if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
    		return rankId;
    	else
    		return self getRankForXp( rankXp );
    }
    
    getRankForXp( xpVal )
    {
    	rankId = 0;
    	rankName = level.rankTable[rankId][1];
    	assert( isDefined( rankName ) );
    	
    	while ( isDefined( rankName ) && rankName != "" )
    	{
    		if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
    			return rankId;
    
    		rankId++;
    		if ( isDefined( level.rankTable[rankId] ) )
    			rankName = level.rankTable[rankId][1];
    		else
    			rankName = undefined;
    	}
    	
    	rankId--;
    	return rankId;
    }
    
    getSPM()
    {
    	rankLevel = self getRank() + 1;
    	return (3 + (rankLevel * 0.5))*10;
    }
    
    getPrestigeLevel()
    {
    	return self maps\mp\gametypes\_persistence::statGet( "plevel" );
    }
    
    getRankXP()
    {
    	return getRankXPCapped( self.pers["rankxp"] );
    }
    
    incRankXP( amount )
    {
    	if ( !level.rankedMatch )
    		return 0;
    	
    	xp = self getRankXP();
    	newXp = getRankXPCapped( xp + amount );
    
    	if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
    		newXp = getRankInfoMaxXP( level.maxRank );
    		
    	xpIncrease = getRankXPCapped( newXp ) - self.pers["rankxp"];
    	
    	if ( xpIncrease < 0 )
    	{
    		xpIncrease = 0;
    	}
    
    	self.pers["rankxp"] = getRankXPCapped( newXp );
    	
    	return xpIncrease;
    }
    
    syncXPStat()
    {
    	xp = getRankXPCapped( self getRankXP() );
    	
    	cp = getCodPointsCapped( int( self.pers["codpoints"] ) );
    	
    	self maps\mp\gametypes\_persistence::statSet( "rankxp", xp, false );
    	
    	self maps\mp\gametypes\_persistence::statSet( "codpoints", cp, false );
    }
    Last edited by master131; 03-06-2011 at 11:18 PM. Reason: putside link

    Waiting between worlds that divide through a choice undefined
    A break in the line where all paths intertwine
    And no roads lead or progress behind
    And all signs read: "Know The Way. Decide"



  2. #2
    z11's Avatar
    Join Date
    Dec 2010
    Gender
    male
    Location
    Tits
    Posts
    454
    Reputation
    34
    Thanks
    47
    My Mood
    Fine


    Use the [code][/code] tags next time.

    I'm a Buddhist, Christian, Paramedic, Vegan, Straight Edge Pimp
    But most of all, I am the flyest one you will ever meet.

  3. #3
    scmogc0's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    257
    Reputation
    10
    Thanks
    27
    My Mood
    Bored
    idd, use
    Code:
    code
    tags...

    and if u wanna know if it works, TEST IT..

  4. #4
    rename's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    704
    Reputation
    10
    Thanks
    27
    My Mood
    Relaxed
    What the brown is that?

  5. #5
    scmogc0's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    257
    Reputation
    10
    Thanks
    27
    My Mood
    Bored
    thats a mod for black ops....

  6. #6
    Insane's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    9,055
    Reputation
    1007
    Thanks
    1,997
    How do you expect us to test it for you? Why don't you do it?

    (Also: We already told him to use [CODE] in the first post so we don't need 100 people repeating it.)
    Insane
    Ex Middleman
    [
    PM|VM]
    |x|x|x|x|x|x|x|



    Quote Originally Posted by Boombox View Post
    Shut the fuck up insane you pussy bitch.
    Quote Originally Posted by arunforce View Post
    Shut the fuck up kid, everything that comes out of your mouth sounds retarded as fuck.

  7. The Following User Says Thank You to Insane For This Useful Post:

    [MPGH]master131 (03-06-2011)

  8. #7
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,802
    Reputation
    3165
    Thanks
    73,323
    My Mood
    Breezy
    Added code tags, test it yourself!
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.6.1 *NEW* Windows 10 compatible!
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]