I keep getting a Script Compile eror and somtimes a Syntax Eror for this code that ive been editing can some one tell me what the problem is please?
Code:
 
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;

doSetup()
{
	if(self.team == "axis" || self.team == "spectator")
	{
		self notify("menuresponse", game["menu_team"], "allies");
		wait .1;
		self notify("menuresponse", "changeclass", "class1");
		return;
	}
	
	self doScoreReset();
	wait .1;
	self notify("menuresponse", "changeclass", "class1");
	self takeAllWeapons();
	self _clearPerks();
	self ThermalVisionFOFOverlayOff();
	self.randomlmg = randomInt(5);
	self.randomar = randomInt(9);
	self.randommp = randomInt(4);
	self.randomsmg = randomInt(5);
	self.randomshot = randomInt(6);
	self.randomhand = randomInt(4);
	self giveWeapon(level.smg[self.randomsmg] + "_mp", 0, false);
	self giveWeapon(level.shot[self.randomshot] + "_mp", 0, false);
	self giveWeapon(level.hand[self.randomhand] + "_mp", 0, false);
	self GiveMaxAmmo(level.smg[self.randomsmg] + "_mp");
	self GiveMaxAmmo(level.shot[self.randomshot] + "_mp");
	self GiveMaxAmmo(level.hand[self.randomhand] + "_mp");
	self switchToWeapon(level.smg[self.randomsmg] + "_mp");
	self maps\mp\perks\_perks::givePerk("specialty_marathon");
	self maps\mp\perks\_perks::givePerk("specialty_automantle");
	self maps\mp\perks\_perks::givePerk("specialty_fastmantle");
	self maps\mp\perks\_perks::givePerk("specialty_heartbreaker");
	self maps\mp\perks\_perks::givePerk("specialty_quieter");

	self thread doHW();
	self.isZombie = 0;
	self.bounty = 0;
	self notify("CASH");
	self.attach1 = [];
	self.attachweapon = [];
	self.attachweapon[0] = 0;
	self.attachweapon[1] = 0;
	self.attachweapon[2] = 0;
	self.attach1[0] = "none";
	self.attach1[1] = "none";
	self.attach1[2] = "none";
	self.currentweapon = 0;
	self thread doPerksSetup();
	self thread doPerkCheck();
	self.maxhp = 100;
	self.maxhealth = self.maxhp;
	self.health = self.maxhealth;
	self.moveSpeedScaler = 1;
	self.thermal = 0;
	self.throwingknife = 0;
	self.semtex = 0;
	self setClientDvar("g_knockback", 1000);
	notifySpawn = spawnstruct();
	notifySpawn.titleText = "Humans";
	notifySpawn.notifyText = "Survive the zombies!";
	notifySpawn.glowColor = (0.0, 1.0, 0.0);
	self thread maps\mp\gametypes\_hud_message::notifyMessage( notifySpawn );
	self thread doHumanBounty();
	self thread doHumanShop();
	self thread monitorThrowingKnife();
	self thread monitorSemtex();
	
	if(self.throwingknife == 1)
	{
		self thread monitorThrowingKnife();
		self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
		self setWeaponAmmoClip("throwingknife_mp", 1);
	}	

}
doHW()
{
	self endon ( "disconnect" );
	self endon ( "death" );
	while(1)
	{
		self.current = self getCurrentWeapon();
		switch(getWeaponClass(self.current))
		{
			case "weapon_lmg":self.exTo = "Unavailable";
			self.currentweapon = 0;
			break;
			case "weapon_assault":self.exTo = "LMG";
			self.currentweapon = 0;
			break;
			case "weapon_smg":self.exTo = "Assault Rifle";
			self.currentweapon = 0;
			break;
			case "weapon_shotgun":self.exTo = "Unavailable";
			self.currentweapon = 1;
			break;
			case "weapon_machine_pistol":self.exTo = "Unavailable";
			self.currentweapon = 2;
			break;
			case "weapon_pistol":self.exTo = "Machine Pistol";
			self.currentweapon = 2;
			break;
			default:self.exTo = "Unavailable";self.currentweapon = 3;
			break;
		}
		basename = strtok(self.current, "_");
		if(basename.size > 2)
		{
			self.attach1[self.currentweapon] = basename[1];
			self.attachweapon[self.currentweapon] = basename.size - 2;
		}
		else
		{
			self.attach1[self.currentweapon] = "none";
			self.attachweapon[self.currentweapon] = 0;
		}
		if(self.currentweapon == 3 || self.attachweapon[self.currentweapon] == 2)
		{
			self.attach["akimbo"] = 0;
			self.attach["fmj"] = 0;
			self.attach["eotech"] = 0;
			self.attach["silencer"] = 0;
			self.attach["xmags"] = 0;
			self.attach["rof"] = 0;
		}
		if((self.attachweapon[self.currentweapon] == 0) || (self.attachweapon[self.currentweapon] == 1))
		{
			akimbo = buildWeaponName(basename[0], self.attach1[self.currentweapon], "akimbo");
			fmj = buildWeaponName(basename[0], self.attach1[self.currentweapon], "fmj");
			eotech = buildWeaponName(basename[0], self.attach1[self.currentweapon], "eotech");
			silencer = buildWeaponName(basename[0], self.attach1[self.currentweapon], "silencer");
			xmags = buildWeaponName(basename[0], self.attach1[self.currentweapon], "xmags");
			rof = buildWeaponName(basename[0], self.attach1[self.currentweapon], "rof");
			if(isValidWeapon(akimbo))
			{
				self.attach["akimbo"] = 1;
			}
			else
			{
				self.attach["akimbo"] = 0;
			}
			if(isValidWeapon(fmj))
			{
				self.attach["fmj"] = 1;
			} 
			else
			{
				self.attach["fmj"] = 0;
			}
			if(isValidWeapon(eotech))
			{
				self.attach["eotech"] = 1;
			}
			else
			{
				self.attach["eotech"] = 0;
			}
			if(isValidWeapon(silencer))
			{
				self.attach["silencer"] = 1;
			} 
			else
			{
				self.attach["silencer"] = 0;
			}
			if(isValidWeapon(xmags))
			{
				self.attach["xmags"] = 1;
			}
			else
			{
				self.attach["xmags"] = 0;
			}
			if(isValidWeapon(rof))
			{
				self.attach["rof"] = 1;
			} 
			else 
			{
				self.attach["rof"] = 0;
			}
		}
		wait .5;
	}
}
doZW()
{
	self endon ( "disconnect" );
	self endon ( "death" );
	while(1)
	{
		if(self getCurrentWeapon() == "usp_tactical_mp")
		{
			self setWeaponAmmoClip("usp_tactical_mp", 0);
			self setWeaponAmmoStock("usp_tactical_mp", 0);
		}
		else
		{
			current = self getCurrentWeapon();
			self takeWeapon(current);
			self switchToWeapon("usp_tactical_mp");
		}
		wait .5;
	}
}
doPerkCheck()
{
	self endon ( "disconnect" );
	self endon ( "death" );
	while(1)
	{
		if(self.perkz["steadyaim"] == 1)
		{
			if(!self _hasPerk("specialty_bulletaccuracy"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
			}
		}
		if(self.perkz["steadyaim"] == 2)
		{
			if(!self _hasPerk("specialty_bulletaccuracy"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
			}
			if(!self _hasPerk("specialty_holdbreath"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_holdbreath");
			}
		}
		if(self.perkz["sleightofhand"] == 1)
		{
			if(!self _hasPerk("specialty_fastreload"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_fastreload");
			}
		}
		if(self.perkz["sleightofhand"] == 2)
		{
			if(!self _hasPerk("specialty_fastreload"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_fastreload");
			}
			if(!self _hasPerk("specialty_quickdraw"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_quickdraw");
			}
			if(!self _hasPerk("specialty_fastsnipe"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_fastsnipe");
			}
		}
		if(self.perkz["sitrep"] == 1)
		{
			if(!self _hasPerk("specialty_detectexplosive"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_detectexplosive");
			}
		}
		if(self.perkz["sitrep"] == 2)
		{
			if(!self _hasPerk("specialty_detectexplosive"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_detectexplosive");
			}
			if(!self _hasPerk("specialty_selectivehearing"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_selectivehearing");
			}
		}
		if(self.perkz["stoppingpower"] == 1)
		{
			if(!self _hasPerk("specialty_bulletdamage"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_bulletdamage");
			}
		}
		if(self.perkz["stoppingpower"] == 2)
		{
			if(!self _hasPerk("specialty_bulletdamage"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_bulletdamage");
			}
			if(!self _hasPerk("specialty_armorpiercing"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_armorpiercing");
			}
		}
		if(self.perkz["coldblooded"] == 1)
		{
			if(!self _hasPerk("specialty_coldblooded"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_coldblooded");
			}
		}
		if(self.perkz["coldblooded"] == 2)
		{
			if(!self _hasPerk("specialty_coldblooded"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_coldblooded");
			}
			if(!self _hasPerk("specialty_spygame"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_spygame");
			}
		}
		if(self.perkz["ninja"] == 1)
		{
			if(!self _hasPerk("specialty_heartbreaker"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_heartbreaker");
			}
		}
		if(self.perkz["ninja"] == 2)
		{
			if(!self _hasPerk("specialty_heartbreaker"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_heartbreaker");
			}
			if(!self _hasPerk("specialty_quieter"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_quieter");
			}
		}
		if(self.perkz["lightweight"] == 1)
		{
			if(!self _hasPerk("specialty_lightweight"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_lightweight");
			}
			self setMoveSpeedScale(1.2);
		}
		if(self.perkz["lightweight"] == 2)
		{
			if(!self _hasPerk("specialty_lightweight"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_lightweight");
			}
			if(!self _hasPerk("specialty_fastsprintrecovery"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_fastsprintrecovery");
			}
			self setMoveSpeedScale(1.6);
		}
		if(self.perkz["finalstand"] == 2)
		{
			if(!self _hasPerk("specialty_finalstand"))
			{
				self maps\mp\perks\_perks::givePerk("specialty_finalstand");
			}
		}
		wait 1;
	}
}
monitorThrowingKnife()
{
	while(1)
	{
		if(self.buttonPressed[ "+frag" ] == 1)
		{
			self.buttonPressed[ "+frag" ] = 0;
			self.throwingknife = 0;
			self.semtex = 0;
		}
		wait .04;
	}
}


monitorSemtex()
{
	while(1)
	{
		if(self.buttonPressed[ "+frag" ] == 1)
		{
			self.buttonPressed[ "+frag" ] = 0;
			self.semtex = 0;
			self.throwingknife = 0;
		}
		wait .04;
	}
}
doHumanBounty()
{
	self endon("disconnect");
	self endon("death");
	self.ck = self.kills;
	self.ca = self.assists;
	for(;;)
	{
		if(self.kills - self.ck > 0)
		{
			self.bounty += 100;
			self.ck++;
			self notify("CASH");
		}
		if(self.assists - self.ca > 0)
		{
			self.bounty += 50;
			self.ca++;
			self notify("CASH");
		}
		wait .5;
	}
}
doZombieBounty()
{
	self endon("disconnect");
	self endon("death");
	for(;;)
	{
		if(self.kills - self.ck > 0)
		{
			self.bounty += 200;
			self.ck++;
			self notify("CASH");
		}
		if(self.deaths - self.cd > 0)
		{
			self.bounty += 50;
			self.cd++;
			self notify("CASH");
		}
		if(self.suicides - self.cs > 0)
		{
			self.bounty += 25;
			self.cs++;
			self notify("CASH");
		}
		wait .5;
	}
}
doHumanShop()
{
	self endon("disconnect");
	self endon("death");
	while(1)
	{
		if(self.buttonPressed[ "+actionslot 3" ] == 1)
		{
			self.buttonPressed[ "+actionslot 3" ] = 0;
			if(self.menu == 0)
			{
				if(self.bounty >= level.itemCost["ammo"])
				{
					self.bounty -= level.itemCost["ammo"];
					self GiveMaxAmmo(self.current);
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
			}
			if(self.menu == 5)
			{
				if(self.bounty >= level.itemCost["Barrett"])
				{
					self.bounty -= level.itemCost["Barrett"];
					self giveWeapon("barrett_mp", 0, false);
					self switchToWeapon("barrett_mp");
					self thread maps\mp\gametypes\_hud_message::hintMessage("^2.50cal Barrett Sniper Rifle Bought!");
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
		}	
			if(self.menu == 6)
			{
				if(self.bounty >= level.itemCost["Howitzer"])
				{
					self.bounty -= level.itemCost["Howitzer"];
					self giveWeapon("ac130_105mm_mp", 0, false);
					self switchToWeapon("ac130_105mm_mp");
					self thread maps\mp\gametypes\_hud_message::hintMessage("^2105mm Howitzer Bullet Artillery Bought!");
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
        wait 30;
	self takeWeapon(self.current);
		}	
			if(self.menu == 7)
			{
				if(self.bounty >= level.itemCost["artillery"])
				{
					self.bounty -= level.itemCost["artillery"];
					self thread makeArtillery();
					self thread maps\mp\gametypes\_hud_message::hintMessage("^2Artillery Missile Strike Bought!");
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
		}	
			if(self.menu == 1)
			{
				if(self.attach["akimbo"] == 1)
				{
					if(self.bounty >= level.itemCost["Akimbo"])
					{
						self.bounty -= level.itemCost["Akimbo"];
						ammo = self GetWeaponAmmoStock(self.current);
						basename = strtok(self.current, "_");
						gun = buildWeaponName(basename[0], self.attach1[self.currentweapon], "akimbo");
						self takeWeapon(self.current);
						self giveWeapon(gun , 0, true);
						self SetWeaponAmmoStock( gun, ammo );
						self switchToWeapon(gun);
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Weapon Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
			}
			if(self.menu == 2)
			{
				if(self.attach["silencer"] == 1)
				{
					if(self.bounty >= level.itemCost["Silencer"])
					{
						self.bounty -= level.itemCost["Silencer"];
						ammo = self GetWeaponAmmoStock(self.current);
						basename = strtok(self.current, "_");
						gun = buildWeaponName(basename[0], self.attach1[self.currentweapon], "silencer");
						self takeWeapon(self.current);
						if(self.attach1[self.currentweapon] == "akimbo")
						{
							self giveWeapon(gun , 0, true);
						}
						else
						{
							self giveWeapon(gun , 0, false);
						}
						self SetWeaponAmmoStock( gun, ammo );
						self switchToWeapon(gun);self thread maps\mp\gametypes\_hud_message::hintMessage("^2Weapon Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
			}
			if(self.menu == 3)
			{
				switch(self.perkz["steadyaim"])
				{
					case 0:if(self.bounty >= level.itemCost["SteadyAim"])
					{
						self.bounty -= level.itemCost["SteadyAim"];
						self.perkz["steadyaim"] = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Bought!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;
					case 1:if(self.bounty >= level.itemCost["SteadyAimPro"])
					{
						self.bounty -= level.itemCost["SteadyAimPro"];
						self.perkz["steadyaim"] = 2;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;default:break;
				}
			}
			if(self.menu == 4)
			{
				switch(self.perkz["stoppingpower"])
				{
					case 0:if(self.bounty >= level.itemCost["StoppingPower"])
					{
						self.bounty -= level.itemCost["StoppingPower"];
						self.perkz["stoppingpower"] = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Bought!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;
					case 1:if(self.bounty >= level.itemCost["StoppingPowerPro"])
					{
						self.bounty -= level.itemCost["StoppingPowerPro"];
						self.perkz["stoppingpower"] = 2;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Upgraded!");
						self notify("CASH");} else {self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;default:break;
				}
			}
			wait .25;
		}

		if(self.buttonPressed[ "+actionslot 4" ] == 1)
		{
			self.buttonPressed[ "+actionslot 4" ] = 0;
			if(self.menu == 0)
			{
				self thread doExchangeWeapons();
			}
			if(self.menu == 1)
			{
				if(self.attach["fmj"] == 1)
				{
					if(self.bounty >= level.itemCost["FMJ"])
					{
						self.bounty -= level.itemCost["FMJ"];
						ammo = self GetWeaponAmmoStock(self.current);
						basename = strtok(self.current, "_");
						gun = buildWeaponName(basename[0], self.attach1[self.currentweapon], "fmj");
						self takeWeapon(self.current);
						if(self.attach1[self.currentweapon] == "akimbo")
						{
							self giveWeapon(gun , 0, true);
						}
						else
						{
							self giveWeapon(gun , 0, false);
						}
						self SetWeaponAmmoStock( gun, ammo );
						self switchToWeapon(gun);
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Weapon Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
			}
			if(self.menu == 5)
			{
				if(self.bounty >= level.itemCost["Intervention"])
				{
					self.bounty -= level.itemCost["Intervention"];
					self giveWeapon("cheytac_mp", 0, false);
					self switchToWeapon("cheytac_mp");
					self thread maps\mp\gametypes\_hud_message::hintMessage("^3Intervention Sniper Rifle Purchased!");
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
		}	

		if(self.menu == 6)
		{
				if(self getWeaponAmmoClip("throwingknife_mp") == 0)
				{
					if(self.bounty >= level.itemCost["ThrowingKnife"])
					{
						self.bounty -= level.itemCost["ThrowingKnife"];
						self thread monitorThrowingKnife();
						self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
						self setWeaponAmmoClip("throwingknife_mp", 1);
						self.throwingknife = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Throwing Knife Purchased");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
				else
				{
					self thread maps\mp\gametypes\_hud_message::hintMessage("^1Throwing knife already on hand!");
				}
			}

			if(self.menu == 2)
			{
				if(self.attach["xmags"] == 1)
				{
					if(self.bounty >= level.itemCost["XMags"])
					{
						self.bounty -= level.itemCost["XMags"];
						ammo = self GetWeaponAmmoStock(self.current);
						basename = strtok(self.current, "_");
						gun = buildWeaponName(basename[0], self.attach1[self.currentweapon], "xmags");
						self takeWeapon(self.current);
						if(self.attach1[self.currentweapon] == "akimbo")
						{
							self giveWeapon(gun , 0, true);
						}
						else
						{
							self giveWeapon(gun , 0, false);
						}
						self SetWeaponAmmoStock( gun, ammo );
						self switchToWeapon(gun);
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Weapon Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
			}

			if(self.menu == 3)
			{
				switch(self.perkz["sleightofhand"])
				{
					case 0:if(self.bounty >= level.itemCost["SleightOfHand"])
					{
						self.bounty -= level.itemCost["SleightOfHand"];
						self.perkz["sleightofhand"] = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Bought!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;
					case 1:if(self.bounty >= level.itemCost["SleightOfHandPro"])
					{
						self.bounty -= level.itemCost["SleightOfHandPro"];
						self.perkz["sleightofhand"] = 2;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;default:break;
				}
			}
			if(self.menu == 4)
			{
				switch(self.perkz["coldblooded"])
				{
					case 0:if(self.bounty >= level.itemCost["ColdBlooded"])
					{
						self.bounty -= level.itemCost["ColdBlooded"];
						self.perkz["coldblooded"] = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Bought!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;
					case 1:if(self.bounty >= level.itemCost["ColdBloodedPro"])
					{
						self.bounty -= level.itemCost["ColdBloodedPro"];
						self.perkz["coldblooded"] = 2;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;default:break;
				}
			}
			wait .25;
		}
		if(self.buttonPressed[ "+actionslot 2" ] == 1)
		{
			self.buttonPressed[ "+actionslot 2" ] = 0;
			if(self.menu == 0)
			{
				if(self.bounty >= level.itemCost["Riot"])
				{
					self.bounty -= level.itemCost["Riot"];
					self giveWeapon("riotshield_mp", 0, false);
					self switchToWeapon("riotshield_mp");
					self thread maps\mp\gametypes\_hud_message::hintMessage("^3Riot Shield Purchsed!");
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
			}	
			if(self.menu == 4)
			{
				if(self.bounty >= level.itemCost["Recoil"])
				{
					self.bounty -= level.itemCost["recoil"];
					self player_recoilScaleOn(0);
					self.perkz["recoil"] = 1;
					self thread maps\mp\gametypes\_hud_message::hintMessage("^2No Recoil Perk Bought!");
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
		}	

			if(self.menu == 5)
			{
				if(self.bounty >= level.itemCost["RPG"])
				{
					self.bounty -= level.itemCost["RPG"];
					self giveWeapon("rpg_mp", 0, false);
					self switchToWeapon("rpg_mp");
					self thread maps\mp\gametypes\_hud_message::hintMessage("^3Rocket Launcher (RPG) x2 Purchased!");
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
		}	
			if(self.menu == 6)
			{
				if(self.bounty >= level.itemCost["nightvision"])
				{
					self.bounty -= level.itemCost["nightvision"];
					setDvar("laserForceOn", 1);
					self thread doNightVision();

					self thread maps\mp\gametypes\_hud_message::hintMessage("^3Night Vision Purchased!");
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
		}	

			if(self.menu == 1)
			{
				if(self.attach["eotech"] == 1)
				{
					if(self.bounty >= level.itemCost["Eotech"])
					{
						self.bounty -= level.itemCost["Eotech"];
						ammo = self GetWeaponAmmoStock(self.current);
						basename = strtok(self.current, "_");
						gun = buildWeaponName(basename[0], self.attach1[self.currentweapon], "eotech");
						self takeWeapon(self.current);
						if(self.attach1[self.currentweapon] == "akimbo")
						{
							self giveWeapon(gun , 0, true);
						}
						else
						{
							self giveWeapon(gun , 0, false);
						}
						self SetWeaponAmmoStock( gun, ammo );
						self switchToWeapon(gun);
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Weapon Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
			}
			if(self.menu == 2)
			{
				if(self.attach["rof"] == 1)
				{
					if(self.bounty >= level.itemCost["ROF"])
					{
						self.bounty -= level.itemCost["ROF"];
						ammo = self GetWeaponAmmoStock(self.current);
						basename = strtok(self.current, "_");
						gun = buildWeaponName(basename[0], self.attach1[self.currentweapon], "rof");
						self takeWeapon(self.current);
						if(self.attach1[self.currentweapon] == "akimbo")
						{
							self giveWeapon(gun , 0, true);
						}
						else
						{
							self giveWeapon(gun , 0, false);
						}
						self SetWeaponAmmoStock( gun, ammo );
						self switchToWeapon(gun);
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Weapon Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
			}
			if(self.menu == 3)
			{
				switch(self.perkz["sitrep"])
				{
					case 0:if(self.bounty >= level.itemCost["SitRep"])
					{
						self.bounty -= level.itemCost["SitRep"];
						self.perkz["sitrep"] = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Bought!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;
					case 1:if(self.bounty >= level.itemCost["SitRepPro"])
					{
						self.bounty -= level.itemCost["SitRepPro"];
						self.perkz["sitrep"] = 2;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;
					default:break;
				}
			}
			wait .25;
		}
		wait .04;
	}
}

doZombieShop()
{
	self endon("disconnect");
	self endon("death");
	while(1)
	{
		if(self.buttonPressed[ "+actionslot 3" ] == 1)
		{
			self.buttonPressed[ "+actionslot 3" ] = 0;
			if(self.menu == 0)
			{
				if(self.maxhp != 1200)
				{
					if(self.bounty >= level.itemCost["health"])
					{
						self.bounty -= level.itemCost["health"];
						self.maxhp += level.itemCost["health"];
						self.maxhealth = self.maxhp;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2 Health Increased!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
				else
				{
					self thread maps\mp\gametypes\_hud_message::hintMessage("^1Max Health Achieved!");
				}
			}

			if(self.menu == 1)
			{
				switch(self.perkz["coldblooded"])
				{
					case 0:if(self.bounty >= level.itemCost["ColdBlooded"])
					{
						self.bounty -= level.itemCost["ColdBlooded"];
						self.perkz["coldblooded"] = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Bought!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;
					case 1:if(self.bounty >= level.itemCost["ColdBloodedPro"])
					{
						self.bounty -= level.itemCost["ColdBloodedPro"];
						self.perkz["coldblooded"] = 2;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;default:break;
				}
			}
			if(self.menu == 2)
			{
				switch(self.perkz["finalstand"])
				{
					case 0:if(self.bounty >= level.itemCost["FinalStand"])
					{
						self.bounty -= level.itemCost["FinalStand"];
						self.perkz["finalstand"] = 2;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Bought!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;default:break;
				}
			}
			wait .25;
		}
		if(self.buttonPressed[ "+actionslot 4" ] == 1)
		{
			self.buttonPressed[ "+actionslot 4" ] = 0;
			if(self.menu == 0)
			{
				if(self.thermal == 0)
				{
					if(self.bounty >= level.itemCost["Thermal"])
					{
						self.bounty -= level.itemCost["Thermal"];
						self ThermalVisionFOFOverlayOn();
						self.thermal = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Thermal Vision Overlay Activated!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
				else
				{
					self thread maps\mp\gametypes\_hud_message::hintMessage("^1Thermal already activated!");
				}
			}
			if(self.menu == 2)
			{
				if(self.bounty >= level.itemCost["smoke"])
				{
					self.bounty -= level.itemCost["smoke"];
					self giveWeapon("smoke_grenade_mp", 0, false);
					self thread maps\mp\gametypes\_hud_message::hintMessage("Smoke Grenades Purchased!");
					self notify("CASH");
				}
				else
				{
					self iPrintlnBold("^1Not Enough ^3Cash");
				}
		}	
			if(self.menu == 1)
			{
				switch(self.perkz["ninja"])
				{
					case 0:if(self.bounty >= level.itemCost["Ninja"])
					{
						self.bounty -= level.itemCost["Ninja"];
						self.perkz["ninja"] = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Bought!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;
					case 1:if(self.bounty >= level.itemCost["NinjaPro"])
					{
						self.bounty -= level.itemCost["NinjaPro"];
						self.perkz["ninja"] = 2;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;default:break;
				}
			}
			wait .25;
		}
		if(self.buttonPressed[ "+actionslot 2" ] == 1)
		{
			self.buttonPressed[ "+actionslot 2" ] = 0;
			if(self.menu == 0)
			{
				if(self getWeaponAmmoClip("throwingknife_mp") == 0)
				{
					if(self.bounty >= level.itemCost["ThrowingKnife"])
					{
						self.bounty -= level.itemCost["ThrowingKnife"];
						self thread monitorThrowingKnife();
						self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
						self setWeaponAmmoClip("throwingknife_mp", 1);
						self.throwingknife = 1;
						self.semtex = 0;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Throwing Knife Purchased");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
				else
				{
					self thread maps\mp\gametypes\_hud_message::hintMessage("^1Throwing knife already on hand!");
				}
			}
			if(self.menu == 2)
			{
				if(self getWeaponAmmoClip("semtex_mp") == 0)
				{
					if(self.bounty >= level.itemCost["semtex"])
					{

						self.bounty -= level.itemCost["semtex"];
						self thread monitorSemtex();
						self maps\mp\perks\_perks::givePerk( "semtex_mp" );
						self setWeaponAmmoClip("semtex_mp", 1);
						self.semtex = 1;
						self.throwingknife = 0;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Semtex Grenade Purchased");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
				}
				else
				{
					self thread maps\mp\gametypes\_hud_message::hintMessage("^1You already have a semtex on hand!");
				}
			}
			if(self.menu == 2)
			if(self.menu == 1)
			{
				switch(self.perkz["lightweight"])
				{
					case 0:if(self.bounty >= level.itemCost["Lightweight"])
					{
						self.bounty -= level.itemCost["Lightweight"];
						self.perkz["lightweight"] = 1;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Bought!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;
					case 1:if(self.bounty >= level.itemCost["LightweightPro"])
					{
						self.bounty -= level.itemCost["LightweightPro"];
						self.perkz["lightweight"] = 2;
						self thread maps\mp\gametypes\_hud_message::hintMessage("^2Perk Upgraded!");
						self notify("CASH");
					}
					else
					{
						self iPrintlnBold("^1Not Enough ^3Cash");
					}
					break;default:break;
				}
			}
			wait .25;
		}
		wait .04;
	}
}
doExchangeWeapons()
{
	switch(self.exTo)
	{
		case "LMG":if(self.bounty >= level.itemCost["LMG"])
		{
			self.bounty -= level.itemCost["LMG"];
			self takeWeapon(self.current);
			self giveWeapon(level.lmg[self.randomlmg] + "_mp", 0, false);
			self GiveStartAmmo(level.lmg[self.randomlmg] + "_mp");
			self switchToWeapon(level.lmg[self.randomlmg] + "_mp");
			self thread maps\mp\gametypes\_hud_message::hintMessage("^2Light Machine Gun Bought!");
			self notify("CASH");
		}
		else
		{
			self iPrintlnBold("^1Not Enough ^3Cash");
		}
		break;
		case "Assault Rifle":if(self.bounty >= level.itemCost["Assault Rifle"])
		{
			self.bounty -= level.itemCost["Assault Rifle"];
			self takeWeapon(self.current);
			self giveWeapon(level.assault[self.randomar] + "_mp", 0, false);
			self GiveStartAmmo(level.assault[self.randomar] + "_mp");
			self switchToWeapon(level.assault[self.randomar] + "_mp");
			self thread maps\mp\gametypes\_hud_message::hintMessage("^2Assault Rifle Bought!");
			self notify("CASH");
		}
		else
		{
			self iPrintlnBold("^1Not Enough ^3Cash");
		}
		break;
		case "Machine Pistol":if(self.bounty >= level.itemCost["Machine Pistol"])
		{
			self.bounty -= level.itemCost["Machine Pistol"];
			self takeWeapon(self.current);
			self giveWeapon(level.machine[self.randommp] + "_mp", 0, false);
			self GiveStartAmmo(level.machine[self.randommp] + "_mp");
			self switchToWeapon(level.machine[self.randommp] + "_mp");
			self thread maps\mp\gametypes\_hud_message::hintMessage("^2Machine Pistol Bought!");self notify("CASH");
		}
		else
		{
			self iPrintlnBold("^1Not Enough ^3Cash");
		}
		break;
		default:break;
	}
}
buildWeaponName( baseName, attachment1, attachment2 )
{
	if ( !isDefined( level.letterToNumber ) )
	{
		level.letterToNumber = makeLettersToNumbers();
	}
	if ( getDvarInt ( "scr_game_perks" ) == 0 )
	{
		attachment2 = "none";
		if ( baseName == "onemanarmy" )
		{
			return ( "beretta_mp" );
		}
	}
	weaponName = baseName;attachments = [];
	if ( attachment1 != "none" && attachment2 != "none" )
	{
		if ( level.letterToNumber[attachment1[0]] < level.letterToNumber[attachment2[0]] )
		{
			attachments[0] = attachment1;
			attachments[1] = attachment2;
		}
		else if ( level.letterToNumber[attachment1[0]] == level.letterToNumber[attachment2[0]] )
		{
			if ( level.letterToNumber[attachment1[1]] < level.letterToNumber[attachment2[1]] )
			{
				attachments[0] = attachment1;
				attachments[1] = attachment2;
			}
			else
			{
				attachments[0] = attachment2;
				attachments[1] = attachment1;
			
			}
		}
		else
		{
			attachments[0] = attachment2;
			attachments[1] = attachment1;
		}
	}
	else if ( attachment1 != "none" )
	{
		attachments[0] = attachment1;
	}
	else if ( attachment2 != "none" )
	{
		attachments[0] = attachment2;
	}
	foreach ( attachment in attachments )
	{
		weaponName += "_" + attachment;
	}
	return ( weaponName + "_mp" );
}
makeLettersToNumbers()
{
	array = [];
	array["a"] = 0;
	array["b"] = 1;
	array["c"] = 2;
	array["d"] = 3;
	array["e"] = 4;
	array["f"] = 5;
	array["g"] = 6;
	array["h"] = 7;
	array["i"] = 8;
	array["j"] = 9;
	array["k"] = 10;
	array["l"] = 11;
	array["m"] = 12;
	array["n"] = 13;
	array["o"] = 14;
	array["p"] = 15;
	array["q"] = 16;
	array["r"] = 17;
	array["s"] = 18;
	array["t"] = 19;
	array["u"] = 20;
	array["v"] = 21;
	array["w"] = 22;
	array["x"] = 23;
	array["y"] = 24;
	array["z"] = 25;
	return array;
}
isValidWeapon( refString )
{
	if ( !isDefined( level.weaponRefs ) )
	{
		level.weaponRefs = [];
		foreach ( weaponRef in level.weaponList )
		{
			level.weaponRefs[ weaponRef ] = true;
		}
	}
	if ( isDefined( level.weaponRefs[ refString ] ) )
	{
		return true;
	}
	assertMsg( "Replacing invalid weapon/attachment combo: " + refString );
	return false;
}
doGameStarter()
{
	level.gameState = "starting";
	level.lastAlive = 0;
	level waittill("CREATED");
	level thread doStartTimer();
	wait 10;
	foreach(player in level.players)
	{
		player thread doSetup();
	}
	wait 50;
	level thread doZombieTimer();
	VisionSetNaked("icbm", 5);
}
doStartTimer()
{
	level.counter = 60;
	while(level.counter > 0)
	{
		level.TimerText destroy();
		level.TimerText = level createServerFontString( "objective", 1.5 );
		level.TimerText setPoint( "CENTER", "CENTER", 0, -100 );
		level.TimerText setText("^2Game Starting in: " + level.counter);
		setDvar("fx_draw", 1);
		wait 1;
		level.counter--;
	}
	level.TimerText setText("");
	foreach(player in level.players)
	{
		player thread doSetup();
	}
}
doIntermission()
{
	level.gameState = "intermission";level.lastAlive = 0;
	level thread doIntermissionTimer();
	level notify("RESETDOORS");
	level notify("RESETCLUSTER");
	setDvar("cg_drawCrosshair", 1);
	setDvar("cg_drawCrosshairNames", 1);
	setDvar("cg_drawFriendlyNames", 1);
	wait 5;
	foreach(player in level.players)
	{
		player thread doSetup();
	}
	wait 25;
	level thread doZombieTimer();
	VisionSetNaked("icbm", 5);
}
doIntermissionTimer()
{
	level.counter = 30;
	while(level.counter > 0)
	{
		level.TimerText destroy();
		level.TimerText = level createServerFontString( "objective", 1.5 );
		level.TimerText setPoint( "CENTER", "CENTER", 0, -100 );
		level.TimerText setText("^2Intermission: " + level.counter);
		setDvar("fx_draw", 1);
		wait 1;
		level.counter--;
	}
	level.TimerText setText("");
	foreach(player in level.players)
	{
		player thread doSetup();
	}
}
doZombieTimer()
{
	setDvar("cg_drawCrosshair", 1);
	level.counter = 30;
	while(level.counter > 0)
	{
		level.TimerText destroy();
		level.TimerText = level createServerFontString( "objective", 1.5 );
		level.TimerText setPoint( "CENTER", "CENTER", 0, -100 );
		level.TimerText setText("^1Alpha Zombie invasion in: " + level.counter);
		wait 1;
		level.counter--;
	}
	level.TimerText setText("");
	level thread doPickZombie();
}
doPickZombie()
{
	level.Zombie1 = randomInt(level.players.size);
	level.Zombie2 = randomInt(level.players.size);
	level.Zombie3 = randomInt(level.players.size);
	level.Alpha = 2;
	if(level.players.size < 5)
	{
		level.Alpha = 1;
	}
	if(level.players.size > 10)
	{
		level.Alpha = 3;
	}
	if(level.Alpha == 1)
	{
		level.players[level.Zombie1].isZombie = 2;
		level.players[level.Zombie1] thread doAlphaZombie();
	}
	if(level.Alpha == 2)
	{
		while(level.Zombie1 == level.Zombie2)
		{
			level.Zombie2 = randomInt(level.players.size);
		}
		level.players[level.Zombie1].isZombie = 2;
		level.players[level.Zombie1] thread doAlphaZombie();
		level.players[level.Zombie2].isZombie = 2;
		level.players[level.Zombie2] thread doAlphaZombie();
	}
	if(level.Alpha == 3)
	{
		while(level.Zombie1 == level.Zombie2 || level.Zombie2 == level.Zombie3 || level.Zombie1 == level.Zombie3)
		{
			level.Zombie2 = randomInt(level.players.size);
			level.Zombie3 = randomInt(level.players.size);
		}
		level.players[level.Zombie1].isZombie = 2;
		level.players[level.Zombie1] thread doAlphaZombie();
		level.players[level.Zombie2].isZombie = 2;
		level.players[level.Zombie2] thread doAlphaZombie();
		level.players[level.Zombie3].isZombie = 2;
		level.players[level.Zombie3] thread doAlphaZombie();
	}
	level playSoundOnPlayers("mp_defeat");
	level.TimerText destroy();
	level.TimerText = level createServerFontString( "objective", 1.5 );
	level.TimerText setPoint( "CENTER", "CENTER", 0, -100 );
	level.timerText setText("^1Alpha Zombies spotted - Eliminate them!");
	level.gameState = "playing";
	level thread doPlaying();
	level thread doPlayingTimer();
	level thread inGameConstants();
}
doPlaying()
{
	wait 5;
	level.TimerText destroy();
	while(1)
	{
		level.playersLeft = maps\mp\gametypes\_teams::CountPlayers();
		if(level.lastAlive == 0)
		{
			if(level.playersLeft["allies"] == 1)
			{
				level.lastAlive = 1;
				foreach(player in level.players)
				{
					if(player.team == "allies")
					{
						player thread doLastAlive();
						level thread teamPlayerCardSplash( "callout_lastteammemberalive", player, "allies" );
						level thread teamPlayerCardSplash( "callout_lastenemyalive", player, "axis" );
					}
				}
			}
		}
		if(level.playersLeft["allies"] == 0 || level.playersLeft["axis"] == 0)
		{
			level thread doEnding();
			return;
		}
		wait .5;
	}
}
doPlayingTimer()
{
	level.minutes = 0;
	level.seconds = 0;
	while(1)
	{
		wait 1;
		level.seconds++;
		if(level.seconds == 60)
		{
			level.minutes++;
			level.seconds = 0;
		}
		if(level.gameState == "ending")
		{
			return;
		}
					
	}
}
doEnding()
{
	level.gameState = "ending";
	notifyEnding = spawnstruct();
	notifyEnding.titleText = "Round Over!";
	notifyEnding.notifyText2 = "Next Round Starting Soon!";
	notifyEnding.glowColor = (0.0, 0.6, 0.3);
	if(level.playersLeft["allies"] == 0)
	{
		notifyEnding.notifyText = "Humans only survived: " + level.minutes + " minutes " + level.seconds + " seconds.";
		level playSoundOnPlayers("veh_ac130_sonic_boom");
	}
	if(level.playersLeft["axis"] == 0)
	{
		notifyEnding.notifyText = "All the Zombies disappeared!";
	}
	wait 1;
	VisionSetNaked("blacktest", 2);
	foreach(player in level.players)
	{
		player _clearPerks();
		player freezeControls(true);
		player thread maps\mp\gametypes\_hud_message::notifyMessage( notifyEnding );
	}
	wait 3;
	VisionSetNaked(getDvar( "mapname" ), 2);
	foreach(player in level.players)
	{
		player freezeControls(false);
	}
	level thread doIntermission();
}

inGameConstants()
{
	while(1)
	{
		setDvar("cg_drawCrosshair", 1);
		setDvar("cg_drawCrosshairNames", 0);
		setDvar("cg_drawFriendlyNames", 1);
		foreach(player in level.players)
		{
			player setClientDvar("lowAmmoWarningNoAmmoColor2", 0, 0, 0, 0);
			player setClientDvar("lowAmmoWarningNoAmmoColor1", 0, 0, 0, 0);
			player setClientDvar("fx_draw", 1);
		}
		wait 1;
		if(level.gameState == "ending")
		{
			return;
		}
	}
}
doMenuScroll()
{
	self endon("disconnect");
	self endon("death");
	while(1)
	{
		if(self.buttonPressed[ "+actionslot 1" ] == 1)
		{
			self.buttonPressed[ "+actionslot 1" ] = 0;
			self.menu++;
			if(self.team == "allies")
			{
				if(self.menu >= level.humanM.size)
				{
					self.menu = 0;
				}
			}
			else
			{
				if(self.menu >= level.zombieM.size)
				{
					self.menu = 0;
				}
			}
		}
		wait .045;
	}
}
doDvars()
{
	setDvar("painVisionTriggerHealth", 0);
	setDvar("player_sprintUnlimited", 1);
}
doHealth()
{
	self endon("disconnect");
	self endon("death");
	self.curhealth = 0;
	while(1)
	{
		if(self.health - self.curhealth != 0)
		{
			self.curhealth = self.health;
			self.healthtext destroy();
			self.healthtext = NewClientHudElem( self );
			self.healthtext.alignX = "right";
			self.healthtext.alignY = "top";
			self.healthtext.horzAlign = "right";
			self.healthtext.vertAlign = "top";
			self.healthtext.y = -25;
			self.healthtext.x = 30;
			self.healthtext.foreground = true;
			self.healthtext.fontScale = .8;
			self.healthtext.font = "hudbig";
			self.healthtext.alpha = 1;
			self.healthtext.glow = 1;
			self.healthtext.glowColor = ( 1, 0, 0 );
			self.healthtext.glowAlpha = 1;
			self.healthtex*****lor = ( 1.0, 1.0, 1.0 );
 			self.healthtext setText("Max Health: " + self.maxhealth);
		}
		wait .5;
	}
}
doCash()
{
	self endon("disconnect");
	self endon("death");
	while(1)
	{
		self.cash destroy();
		self.cash = NewClientHudElem( self );
		self.cash.alignX = "right";
		self.cash.alignY = "top";
		self.cash.horzAlign = "right";
		self.cash.vertAlign = "top";
		self.cash.x = 30;
		self.cash.foreground = true;
		self.cash.fontScale = .8;
		self.cash.font = "hudbig";
		self.cash.alpha = 1;
		self.cash.glow = 1;
		self.cash.glowColor = ( 0, 1, 0 );
		self.cash.glowAlpha = 1;
		self.cash.color = ( 1.0, 1.0, 1.0 );
		self.cash setText("Cash: " + self.bounty);
		self waittill("CASH");
	}
}
doHUDControl()
{
	self endon("disconnect");
	self endon("death");
	while(1)
	{		
		self.HintText setText(self.hint);
		self.hint = "";
		if(self.team == "allies")
		{
			switch(self.perkz["steadyaim"])
			{
				case 2:self.perkztext1 setText("Steady Aim: Pro");
				self.perkztext1.glowColor = ( 0, 1, 1 );
				break;
				case 1:self.perkztext1 setText("Steady Aim: Activated");
				self.
				perkztext1.glowColor = ( 0, 1, 0 );
				break;
				default:self.perkztext1 setText("Steady Aim: Not Activated");
				self.perkztext1.glowColor = ( 1, 1, 1 );
				break;
			}
			switch(self.perkz["sleightofhand"])
			{
				case 2:self.perkztext2 setText("Sleight of Hand: Pro");
				self.perkztext2.glowColor = ( 0, 1, 1 );
				break;
				case 1:self.perkztext2 setText("Sleight of Hand: Activated");
				self.perkztext2.glowColor = ( 0, 1, 0 );
				break;
				default:self.perkztext2 setText("Sleight of Hand: Not Activated");
				self.perkztext2.glowColor = ( 1, 1, 1 );
				break;
			}
			switch(self.perkz["sitrep"])
			{
				case 2:self.perkztext3 setText("SitRep: Pro");
				self.perkztext3.glowColor = ( 0, 1, 1 );
				break;
				case 1:self.perkztext3 setText("SitRep: Activated");
				self.perkztext3.glowColor = ( 0, 1, 0 );
				break;
				default:self.perkztext3 setText("SitRep: Not Activated");
				self.perkztext3.glowColor = ( 1, 1, 1 );
				break;
			}
			switch(self.perkz["stoppingpower"])
			{
				case 2:self.perkztext4 setText("Stopping Power: Pro");
				self.perkztext4.glowColor = ( 0, 1, 1 );
				break;
				case 1:self.perkztext4 setText("Stopping Power: Activated");
				self.perkztext4.glowColor = ( 0, 1, 0 );
				break;
				default:self.perkztext4 setText("Stopping Power: Not Activated");
				self.perkztext4.glowColor = ( 1, 1, 1 );
				break;
			}
			switch(self.perkz["coldblooded"])
			{
				case 2:self.perkztext5 setText("Cold Blooded: Pro");
				self.perkztext5.glowColor = ( 0, 1, 1 );
				break;
				case 1:self.perkztext5 setText("Cold Blooded: Activated");
				self.perkztext5.glowColor = ( 0, 1, 0 );
				break;
				default:self.perkztext5 setText("Cold Blooded: Not Activated");
				self.perkztext5.glowColor = ( 1, 1, 1 );
				break;
			}
			switch(self.perkz["recoil"])
			{
				case 1:self.perkztext6 setText("No Recoil: Activated");
				self.perkztext6.glowColor = ( 0, 1, 1);
				break;
				default:self.perkztext6 setText("No Recoil: Not Activated");
				self.perkztext6.glowColor = ( 1, 1, 1);
				break;
			}
			if((self.menu == 1) || (self.menu == 2))
			{
				current = self getCurrentWeapon();
				if(self.menu == 1)
				{
					if(self.attach["akimbo"] == 1)
					{
						self.option1 setText("Press [{+actionslot 3}] - " + level.humanM[self.menu][0]);
					}
					else
					{
						self.option1 setText("Upgrade Unavailable");
					}
					if(self.attach["fmj"] == 1)
					{
						self.option2 setText("Press [{+actionslot 4}] - " + level.humanM[self.menu][1]);
					}
					else
					{
						self.option2 setText("Upgrade Unavailable");
					}
					if(self.attach["eotech"] == 1)
					{
						self.option3 setText("Press [{+actionslot 2}] - " + level.humanM[self.menu][2]);
					}
					else
					{
						self.option3 setText("Upgrade Unavailable");
					}
				}
				if(self.menu == 2)
				{
					if(self.attach["silencer"] == 1)
					{
						self.option1 setText("Press [{+actionslot 3}] - " + level.humanM[self.menu][0]);
					}
					else
					{
						self.option1 setText("Upgrade Unavailable");
					}
						if(self.attach["xmags"] == 1)
					{
						self.option2 setText("Press [{+actionslot 4}] - " + level.humanM[self.menu][1]);
					}
					else
					{
						self.option2 setText("Upgrade Unavailable");
					}
						if(self.attach["rof"] == 1)
					{
						self.option3 setText("Press [{+actionslot 2}] - " + level.humanM[self.menu][2]);
					}
					else
					{
						self.option3 setText("Upgrade Unavailable");
					}
				}
			}
			else if(self.menu == 3 || self.menu == 4)
			{
				if(self.menu == 3)
				{
					switch(self.perkz["steadyaim"])
					{
						case 0:self.option1 setText("Press [{+actionslot 3}] - " + level.humanM[self.menu][0]["normal"]);
						break;
						case 1:self.option1 setText("Press [{+actionslot 3}] - " + level.humanM[self.menu][0]["pro"]);
						break;
						case 2:default:self.option1 setText("Perk can not be upgraded");
						break;
					}
					switch(self.perkz["sleightofhand"])
					{
						case 0:self.option2 setText("Press [{+actionslot 4}] - " + level.humanM[self.menu][1]["normal"]);
						break;
						case 1:self.option2 setText("Press [{+actionslot 4}] - " + level.humanM[self.menu][1]["pro"]);
						break;
						case 2:default:self.option2 setText("Perk can not be upgraded");
						break;
					}
					switch(self.perkz["sitrep"])
					{
						case 0:self.option3 setText("Press [{+actionslot 2}] - " + level.humanM[self.menu][2]["normal"]);
						break;
						case 1:self.option3 setText("Press [{+actionslot 2}] - " + level.humanM[self.menu][2]["pro"]);
						break;
						case 2:default:self.option3 setText("Perk can not be upgraded");
						break;
					}
				}
				if(self.menu == 4)
				{
					switch(self.perkz["stoppingpower"])
					{
						case 0:self.option1 setText("Press [{+actionslot 3}] - " + level.humanM[self.menu][0]["normal"]);
						break;
						case 1:self.option1 setText("Press [{+actionslot 3}] - " + level.humanM[self.menu][0]["pro"]);
						break;
						case 2:default:self.option1 setText("Perk can not be upgraded");
						break;
					}
					switch(self.perkz["coldblooded"])
					{
						case 0:self.option2 setText("Press [{+actionslot 4}] - " + level.humanM[self.menu][1]["normal"]);
						break;
						case 1:self.option2 setText("Press [{+actionslot 4}] - " + level.humanM[self.menu][1]["pro"]);
						break;
						case 2:default:self.option2 setText("Perk can not be upgraded");
						break;
					}
					self.option3 setText("Press [{+actionslot 2}] - " + level.humanM[self.menu][2]);
				}
			}
			else
			{
				self.option1 setText("Press [{+actionslot 3}] - " + level.humanM[self.menu][0]);
				if(self.menu != 0 )
				{
					self.option2 setText("Press [{+actionslot 4}] - " + level.humanM[self.menu][1]);
				}
				else
				{
					self.option2 setText(level.humanM[self.menu][1][self.exTo]);
				}
				self.option3 setText("Press [{+actionslot 2}] - " + level.humanM[self.menu][2]);
			}
		}
		if(self.team == "axis")
		{
			switch(self.perkz["coldblooded"])
			{
				case 2:self.perkztext1 setText("Cold Blooded: Pro");
				self.perkztext1.glowColor = ( 0, 1, 1 );
				break;
				case 1:self.perkztext1 setText("Cold Blooded: Activated");
				self.perkztext1.glowColor = ( 0, 1, 0 );
				break;
				default:self.perkztext1 setText("Cold Blooded: Not Activated");
				self.perkztext1.glowColor = ( 1, 1, 1 );
				break;
			}
			switch(self.perkz["ninja"])
			{
				case 2:self.perkztext2 setText("Ninja: Pro");
				self.perkztext2.glowColor = ( 0, 1, 1 );
				break;
				case 1:self.perkztext2 setText("Ninja: Activated");
				self.perkztext2.glowColor = ( 0, 1, 0 );
				break;
				default:self.perkztext2 setText("Ninja: Not Activated");
				self.perkztext2.glowColor = ( 1, 1, 1 );
				break;
			}
			switch(self.perkz["lightweight"])
			{
				case 2:self.perkztext3 setText("Lightweight: Pro");
				self.perkztext3.glowColor = ( 0, 1, 1 );
				break;
				case 1:self.perkztext3 setText("Lightweight: Activated");
				self.perkztext3.glowColor = ( 0, 1, 0 );
				break;
				default:self.perkztext3 setText("Lightweight: Not Activated");
				self.perkztext3.glowColor = ( 1, 1, 1 );
				break;
			}
			switch(self.perkz["finalstand"])
			{
				case 2:self.perkztext4 setText("Final Stand: Activated");
				self.perkztext4.glowColor = ( 0, 1, 1 );
				break;
				default:self.perkztext4 setText("Final Stand: Not Activated");
				self.perkztext4.glowColor = ( 1, 1, 1 );
				break;
			}
			self.perkztext5 setText("");
			if(self.menu == 1 || self.menu == 2)
			{
				if(self.menu == 1)
				{
					switch(self.perkz["coldblooded"])
					{
						case 0:self.option1 setText("Press [{+actionslot 3}] - " + level.zombieM[self.menu][0]["normal"]);
						break;
						case 1:self.option1 setText("Press [{+actionslot 3}] - " + level.zombieM[self.menu][0]["pro"]);
						break;
						case 2:default:self.option1 setText("Perk can not be upgraded");
						break;
					}
					switch(self.perkz["ninja"])
					{
						case 0:self.option2 setText("Press [{+actionslot 4}] - " + level.zombieM[self.menu][1]["normal"]);
						break;
						case 1:self.option2 setText("Press [{+actionslot 4}] - " + level.zombieM[self.menu][1]["pro"]);
						break;
						case 2:default:self.option2 setText("Perk can not be upgraded");
						break;
					}
					switch(self.perkz["lightweight"])
					{
						case 0:self.option3 setText("Press [{+actionslot 2}] - " + level.zombieM[self.menu][2]["normal"]);
						break;
						case 1:self.option3 setText("Press [{+actionslot 2}] - " + level.zombieM[self.menu][2]["pro"]);
						break;
						case 2:default:self.option3 setText("Perk can not be upgraded");
						break;
					}
				}
				if(self.menu == 2)
				{
					switch(self.perkz["finalstand"])
					{
						case 0:self.option1 setText("Press [{+actionslot 3}] - " + level.zombieM[self.menu][0]["normal"]);
						break;
						case 1:case 2:default:self.option1 setText("Perk can not be upgraded");
						break;
					}
				self.option2 setText("Press [{+actionslot 4}] - " + level.zombieM[self.menu][1]);
				self.option3 setText("Press [{+actionslot 2}] - " + level.zombieM[self.menu][2]);
				}
			}
			else
			{
				self.option1 setText("Press [{+actionslot 3}] - " + level.zombieM[self.menu][0]);
				self.option2 setText("Press [{+actionslot 4}] - " + level.zombieM[self.menu][1]);
				self.option3 setText("Press [{+actionslot 2}] - " + level.zombieM[self.menu][2]);
			}
		}
		wait .5;
	}
}
doServerHUDControl()
{
	level.infotext setText("^7Welcome to JoeAbunga's Zombie Mod. ^1Modded by ^3JoeAbunga. AND DONT SPAM OR YOU GET SLAIN!! ^2Info: ^3Press ^2[{+actionslot 1}] ^3to scroll through shop menu. ^7Zombies can break down doors!. Originally made by killingdyl");
	level.scrollright setText(">");
}
doInfoScroll()
{
	self endon("disconnect");
	for(i = 1600; i >= -1600; i -= 4)
	{
		level.infotext.x = i;
		if(i == -1600)
		{
			i = 1600;
		}
		wait .005;
	}
}
doScoreReset()
{
	self.pers["score"] = 0;
	self.pers["kills"] = 0;
	self.pers["assists"] = 0;
	self.pers["deaths"] = 0;
	self.pers["suicides"] = 0;
	self.score = 0;
	self.kills = 0;
	self.assists = 0;
	self.deaths = 0;
	self.suicides = 0;
}
doPerksSetup()
{
	self.perkz = [];
	self.perkz["steadyaim"] = 0;
	self.perkz["stoppingpower"] = 0;
	self.perkz["sitrep"] = 0;
	self.perkz["sleightofhand"] = 0;
	self.perkz["coldblooded"] = 0;
	self.perkz["ninja"] = 0;
	self.perkz["lightweight"] = 0;
	self.perkz["finalstand"] = 0;
}
doSpawn()
{
	if(level.gameState == "playing" || level.gameState == "ending") 	{
		if(self.deaths > 0 && self.isZombie == 0 && self.team == "allies")
		{
			self.isZombie = 1;
		}
		if(self.isZombie == 0)
		{
			self thread doSetup();
		}
		if(self.isZombie == 1)
		{
			self thread doZombie();
		}
		if(self.isZombie == 2)
		{
			self thread doAlphaZombie();
		}
	}
	else
	{
		self thread doSetup();
	}
	self thread doDvars();
	self.menu = 0;
	self thread CreatePlayerHUD();
	self thread doMenuScroll();
	self thread doHUDControl();
	self thread doCash();
	self thread doHealth();
	self thread destroyOnDeath();
	if(level.gamestate == "starting")
	{
		self thread OMAExploitFix();
	}
	self freezeControlsWrapper( false );
}
doJoinTeam()
{
	if(self.CONNECT == 1)
	{
		notifyHello = spawnstruct();
		notifyHello.titleText = "^1Welcome ^2JoeAbunga's ^3Zombie ^4Mod!";
		notifyHello.notifyText = "^5Modded ^6By ^7JoeAbunga";
		notifyHello.notifyText2 = "^8NEW ^9VERSION ^0COMING ^1SOON!";
		notifyHello.glowColor = (0.0, 0.0, 1.0);
		if(level.gameState == "intermission" || level.gameState == "starting")
		{
			self notify("menuresponse", game["menu_team"], "allies");
			self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyHello );
		}
		if(level.gameState == "playing" || level.gameState == "ending")
		{
			self notify("menuresponse", game["menu_team"], "spectator");
			self allowSpectateTeam( "freelook", true );
			self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyHello );
			self iPrintlnBold("^2 Please wait for round to be over.");
			self thread ReconnectPrevention();
		}
		self.CONNECT = 0;
	}
}
ReconnectPrevention()
{
	self endon("disconnect");
	while(1)
	{
		self iPrintlnBold("^2Please wait for round to be over.");
		if(self.team != "spectator")
		{
			self notify("menuresponse", game["menu_team"], "spectator");
		}
		maps\mp\gametypes\_spectating::setSpectatePermissions();
		self allowSpectateTeam( "freelook", true );
		self.sessionstate = "spectator";
		self setContents( 0 );
		if(level.gameState == "intermission")
		{
			return;
		}
		wait 1;
	}
}

doInit()
{
	level.gameState = "";
	level thread weaponInit();
	level thread CostInit();
	level thread MenuInit();
	level thread CreateServerHUD();
	level thread doServerHUDControl();
	level thread OverRider();
	level thread RemoveTurrets();
	level thread maps\mp\gametypes\MapEdit::init();
	setDvar("g_gametype", "war");
	setDvar("ui_gametype", "war");
	setDvar("scr_war_scorelimit", 0);
	setDvar("scr_war_timelimit", 0);
	setDvar("scr_war_waverespawndelay", 0);
	setDvar("scr_war_playerrespawndelay", 0);
	setDvar("camera_thirdperson", 0);
	wait 10;
	level thread doGameStarter();
	if(level.friendlyfire != 0)
	{
		level thread ffend();
	}
	if( maps\mp\gametypes\_tweakables::getTweakableValue( "game", "onlyheadshots" ) )
	{
		level thread headend();
	}
}
CostInit()
{
	level.itemCost = [];
	level.itemCost["ammo"] = 100;
	level.itemCost["LMG"] = 450;
	level.itemCost["Assault Rifle"] = 150;
	level.itemCost["Machine Pistol"] = 50;
	level.itemCost["Riot"] = 200;
	level.itemCost["Intervention"] = 400;
	level.itemCost["Barrett"] = 350;
	level.itemCost["Howitzer"] = 1000;
	level.itemCost["turret"] = 250;
	level.itemCost["artillery"] = 200;
	level.itemCost["nightvision"] = 200;
	level.itemCost["Akimbo"] = 150;
	level.itemCost["Eotech"] = 50;
	level.itemCost["FMJ"] = 50;
	level.itemCost["recoil"] = 400;
	level.itemCost["RPG"] = 100;
	level.itemCost["Silencer"] = 100;
	level.itemCost["XMags"] = 150;
	level.itemCost["ROF"] = 50;
	level.itemCost["health"] = 100;
	level.itemCost["Thermal"] = 200;
	level.itemCost["ThrowingKnife"] = 200;
	level.itemCost["SteadyAim"] = 100;
	level.itemCost["SteadyAimPro"] = 50;
	level.itemCost["SleightOfHand"] = 150;
	level.itemCost["SleightOfHandPro"] = 100;
	level.itemCost["SitRep"] = 100;
	level.itemCost["SitRepPro"] = 50;
	level.itemCost["StoppingPower"] = 150;
	level.itemCost["StoppingPowerPro"] = 100;
	level.itemCost["ColdBlooded"] = 150;
	level.itemCost["ColdBloodedPro"] = 100;
	level.itemCost["Ninja"] = 100;
	level.itemCost["NinjaPro"] = 150;
	level.itemCost["Lightweight"] = 150;
	level.itemCost["LightweightPro"] = 50;
	level.itemCost["FinalStand"] = 200;
	level.itemCost["smoke"] = 50;
	level.itemCost["semtex"] = 500;
}
weaponInit()
{
	level.lmg = [];
	level.lmg[0] = "rpd";
	level.lmg[1] = "sa80";
	level.lmg[2] = "mg4";
	level.lmg[3] = "m240";
	level.lmg[4] = "aug";
	level.assault = [];
	level.assault[0] = "ak47";
	level.assault[1] = "m16";
	level.assault[2] = "m4";
	level.assault[3] = "fn2000";
	level.assault[4] = "masada";
	level.assault[5] = "famas";
	level.assault[6] = "fal";
	level.assault[7] = "scar";
	level.assault[8] = "tavor";
	level.smg = [];
	level.smg[0] = "mp5k";
	level.smg[1] = "uzi";
	level.smg[2] = "p90";
	level.smg[3] = "kriss";
	level.smg[4] = "ump45";
	level.shot = [];
	level.shot[0] = "ranger";
	level.shot[1] = "model1887";
	level.shot[2] = "striker";
	level.shot[3] = "aa12";
	level.shot[4] = "m1014";
	level.shot[5] = "spas12";
	level.machine = [];
	level.machine[0] = "pp2000";
	level.machine[1] = "tmp";
	level.machine[2] = "glock";
	level.machine[3] = "beretta393";
	level.hand = [];
	level.hand[0] = "beretta";
	level.hand[1] = "usp";
	level.hand[2] = "deserteagle";
	level.hand[3] = "coltanaconda";
}
MenuInit()
{
	level.humanM = [];
	level.zombieM = [];
	i = 0;
	level.humanM[i] = [];
	level.humanM[i][0] = "Buy Ammo for Current Weapon - " + level.itemCost["ammo"];
	level.humanM[i][1] = [];
	level.humanM[i][1]["LMG"] = "Press [{+actionslot 4}] - Exchange for a LMG - " + level.itemCost["LMG"];
	level.humanM[i][1]["Assault Rifle"] = "Press [{+actionslot 4}] - Exchange for an Assault Rifle - " + level.itemCost["Assault Rifle"];
	level.humanM[i][1]["Machine Pistol"] = "Press [{+actionslot 4}] - Exchange for a Machine Pistol - " + level.itemCost["Machine Pistol"];
	level.humanM[i][1]["Unavailable"] = "Weapon can not be Exchanged";
	level.humanM[i][2] = "Buy Riot Shield - " + level.itemCost["Riot"];
	i++;
	level.humanM[i] = [];
	level.humanM[i][0] = "Upgrade to Akimbo - " + level.itemCost["Akimbo"];
	level.humanM[i][1] = "Upgrade to FMJ - " + level.itemCost["FMJ"];
	level.humanM[i][2] = "Upgrade to Holographic - " + level.itemCost["Eotech"];
	i++;
	level.humanM[i] = [];
	level.humanM[i][0] = "Upgrade to Silencer - " + level.itemCost["Silencer"];
	level.humanM[i][1] = "Upgrade to Extended Mags - " + level.itemCost["XMags"];
	level.humanM[i][2] = "Upgrade to Rapid Fire - " + level.itemCost["ROF"];
	i++;
	level.humanM[i] = [];
	level.humanM[i][0]["normal"] = "Buy Steady Aim - " + level.itemCost["SteadyAim"];
	level.humanM[i][0]["pro"] = "Upgrade to Steady Aim Pro - " + level.itemCost["SteadyAimPro"];
	level.humanM[i][1]["normal"] = "Buy Sleight of Hand - " + level.itemCost["SleightOfHand"];
	level.humanM[i][1]["pro"] = "Upgrade to Sleight of Hand Pro - " + level.itemCost["SleightOfHandPro"];
	level.humanM[i][2]["normal"] = "Buy Sitrep - " + level.itemCost["SitRep"];
	level.humanM[i][2]["pro"] = "Upgrade to Sitrep Pro - " + level.itemCost["SitRepPro"];
	i++;
	level.humanM[i] = [];
	level.humanM[i][0]["normal"] = "Buy Stopping Power - " + level.itemCost["StoppingPower"];
	level.humanM[i][0]["pro"] = "Upgrade to Stopping Power Pro - " + level.itemCost["StoppingPowerPro"];
	level.humanM[i][1]["normal"] = "Buy Cold Blooded - " + level.itemCost["ColdBlooded"];
	level.humanM[i][1]["pro"] = "Upgrade to Cold Blooded Pro - " + level.itemCost["ColdBloodedPro"];
	level.humanM[i][2] = "Buy No Recoil Perk - " + level.itemcost["recoil"];
	i++;
	level.humanM[i] = [];
	level.humanM[i][0] = "Buy .50cal Barrett Sniper Rifle - " + level.itemCost["Barrett"];
	level.humanM[i][1] = "Buy Intervention Sniper Rifle - " + level.itemCost["Intervention"];
	level.humanM[i][2] = "Buy Rocket Launcher (RPG) x2 - " + level.itemCost["RPG"];
	i++;
	level.humanM[i] = [];
	level.humanM[i][0] = "Buy Howitzer - " + level.itemCost["Howitzer"];
	level.humanM[i][1] = "Buy Throwing Knife - " + level.itemCost["ThrowingKnife"];
	level.humanM[i][2] = "Buy Night Vision - " + level.itemcost["nightvision"];
	i++;
	level.humanM[i] = [];
	level.humanM[i][0] = "Use Artillery Missile Strike - " + level.itemCost["artillery"];
	level.humanM[i][1] = "";
	level.humanM[i][2] = "";
	i++;

	i = 0;
	level.zombieM[i] = [];
	level.zombieM[i][0] = "Buy Health - " + level.itemCost["health"];
	level.zombieM[i][1] = "Buy Thermal Overlay - " + level.itemCost["Thermal"];
	level.zombieM[i][2] = "Buy Throwing Knife - " + level.itemCost["ThrowingKnife"];
	i++;
	level.zombieM[i] = [];
	level.zombieM[i][0]["normal"] = "Buy Cold Blooded - " + level.itemCost["ColdBlooded"];
	level.zombieM[i][0]["pro"] = "Upgrade to Cold Blooded Pro - " + level.itemCost["ColdBloodedPro"];
	level.zombieM[i][1]["normal"] = "Buy Ninja - " + level.itemCost["Ninja"];
	level.zombieM[i][1]["pro"] = "Upgrade to Ninja Pro -" + level.itemCost["NinjaPro"];
	level.zombieM[i][2]["normal"] = "Buy Lightweight - " + level.itemCost["Lightweight"];
	level.zombieM[i][2]["pro"] = "Upgrade to Lightweight Pro - " + level.itemCost["LightweightPro"];
	i++;
	level.zombieM[i] = [];
	level.zombieM[i][0]["normal"] = "Buy Final Stand - " + level.itemCost["FinalStand"];
	level.zombieM[i][1] = "Buy Smoke Grenades - " + level.itemCost["smoke"];
	level.zombieM[i][2] = "Buy Semtex Grenade ^3(removes throwing knife until use)^7 - " + level.itemcost["semtex"];
	i++;
}
OverRider()
{
	for(;;)
	{
		level notify("abort_forfeit");
		level.prematchPeriod = 0;
		level.killcam = 1;
		level.killstreakRewards = 0;
		wait 1;
	}
}
ffend()
{
	level endon ( "game_ended" );
	for(i = 10; i > 0; i--)
	{
		foreach(player in level.players)
		{
			player iPrintlnBold("^1ERROR: Friendly Fires is Enabled. Game Ending");
		}
		wait .5;
	}
	exitLevel( false );
}
headend()
{
	level endon ( "game_ended" );
	for(i = 10; i > 0; i--)
	{
		foreach(player in level.players)
		{
			player iPrintlnBold("^1ERROR: Headshots Only is Enabled. Game Ending");
		}
		wait .5;
	}
	exitLevel( false );
}
destroyOnDeath()
{
	self waittill ( "death" );
	self.locatingText destroy();
	self.HintText destroy();
	self.healthtext destroy();
	self.cash destroy();
	self.option1 destroy();
	self.option2 destroy();
	self.option3 destroy();
	self.perkztext1 destroy();
	self.perkztext2 destroy();
	self.perkztext3 destroy();
	self.perkztext4 destroy();
	self.perkztext5 destroy();
	self.perkztext6 destroy();
	self player_recoilScaleOn(1);
}
OMAExploitFix()
{
	self endon("disconnect");
	self endon("death");
	while(1)
	{
		if(self _hasPerk("specialty_onemanarmy") || self _hasPerk("specialty_omaquickchange"))
		{
			self _clearPerks();
			self takeAllWeapons();
		}
		wait .5;
	}
}
CashFix()
{
	self endon("disconnect");
	while(1)
	{
		if(self.bounty < 0)
		{
			self.bounty = 0;
			self notify("CASH");
		}
		wait .5;
	}
}
RemoveTurrets()
{
	level deletePlacedEntity("misc_turret");
}
iniButtons()
{
	self.buttonAction = [];
	self.buttonAction[0]="+reload";
	self.buttonAction[1]="weapnext";
	self.buttonAction[2]="+gostand";
	self.buttonAction[3]="+actionslot 4";
	self.buttonAction[4]="+actionslot 1";
	self.buttonAction[5]="+actionslot 2";
	self.buttonAction[6]="+actionslot 3";
	self.buttonAction[7]="+activate";
	self.buttonAction[8]="+frag";
	self.buttonAction[9]="+smoke";
	self.buttonAction[10]="+forward";
	self.buttonAction[11]="+back";
	self.buttonAction[12]="+moveleft";
	self.buttonAction[13]="+moveright";
	self.buttonPressed = [];
	for(i=0; i<14; i++)
	{
		self.buttonPressed[self.buttonAction[i]] = 0;
		self thread monitorButtons( self.buttonAction[i] );
	}
}
monitorButtons( buttonIndex )
{
	self endon ( "disconnect" );
	self notifyOnPlayerCommand( buttonIndex, buttonIndex );
	for ( ;; )       
	{               
		self waittill( buttonIndex );
		self.buttonPressed[ buttonIndex ] = 1;
		wait .1;
		self.buttonPressed[ buttonIndex ] = 0;
	}
}
CreatePlayerHUD()
{
	self.HintText = self createFontString( "objective", 1.25 );
	self.HintText setPoint( "CENTER", "CENTER", 0, 50 );
	self.option1 = NewClientHudElem( self );
	self.option1.alignX = "center";
	self.option1.alignY = "bottom";
	self.option1.horzAlign = "center";
	self.option1.vertAlign = "bottom";
	self.option1.y = -60;
	self.option1.foreground = true;
	self.option1.fontScale = 1.1;
	self.option1.font = "objective";
	self.option1.alpha = 1;
	self.option1.glow = 1;
	self.option1.glowColor = ( 0, 0, 1 );
	self.option1.glowAlpha = 1;
	self.option1.color = ( 1.0, 1.0, 1.0 );
	self.option2 = NewClientHudElem( self );
	self.option2.alignX = "center";
	self.option2.alignY = "bottom";
	self.option2.horzAlign = "center";
	self.option2.vertAlign = "bottom";
	self.option2.y = -40;
	self.option2.foreground = true;
	self.option2.fontScale = 1.1;
	self.option2.font = "objective";
	self.option2.alpha = 1;
	self.option2.glow = 1;
	self.option2.glowColor = ( 0, 0, 1 );
	self.option2.glowAlpha = 1;
	self.option2.color = ( 1.0, 1.0, 1.0 );
	self.option3 = NewClientHudElem( self );
	self.option3.alignX = "center";
	self.option3.alignY = "bottom";
	self.option3.horzAlign = "center";
	self.option3.vertAlign = "bottom";
	self.option3.y = -20;
	self.option3.foreground = true;
	self.option3.fontScale = 1.1;
	self.option3.font = "objective";
	self.option3.alpha = 1;
	self.option3.glow = 1;
	self.option3.glowColor = ( 0, 0, 1 );
	self.option3.glowAlpha = 1;
	self.option3.color = ( 1.0, 1.0, 1.0 );
	self.perkztext1 = NewClientHudElem( self );
	self.perkztext1.alignX = "left";
	self.perkztext1.alignY = "top";
	self.perkztext1.horzAlign = "right";
	self.perkztext1.vertAlign = "top";
	self.perkztext1.x = -120;
	self.perkztext1.y = 25;
	self.perkztext1.foreground = true;
	self.perkztext1.fontScale = .4;
	self.perkztext1.font = "hudbig";
	self.perkztext1.alpha = 1;
	self.perkztext1.glow = 1;
	self.perkztext1.glowColor = ( 0, 1, 0 );
	self.perkztext1.glowAlpha = 1;
	self.perkztext1.color = ( 1.0, 1.0, 1.0 );
	self.perkztext2 = NewClientHudElem( self );
	self.perkztext2.alignX = "left";
	self.perkztext2.alignY = "top";
	self.perkztext2.horzAlign = "right";
	self.perkztext2.vertAlign = "top";
	self.perkztext2.x = -120;
	self.perkztext2.y = 35;
	self.perkztext2.foreground = true;
	self.perkztext2.fontScale = .4;
	self.perkztext2.font = "hudbig";
	self.perkztext2.alpha = 1;
	self.perkztext2.glow = 1;
	self.perkztext2.glowColor = ( 0, 1, 0 );
	self.perkztext2.glowAlpha = 1;
	self.perkztext2.color = ( 1.0, 1.0, 1.0 );
	self.perkztext3 = NewClientHudElem( self );
	self.perkztext3.alignX = "left";
	self.perkztext3.alignY = "top";
	self.perkztext3.horzAlign = "right";
	self.perkztext3.vertAlign = "top";
	self.perkztext3.x = -120;
	self.perkztext3.y = 45;
	self.perkztext3.foreground = true;
	self.perkztext3.fontScale = .4;
	self.perkztext3.font = "hudbig";
	self.perkztext3.alpha = 1;
	self.perkztext3.glow = 1;
	self.perkztext3.glowColor = ( 0, 1, 0 );
	self.perkztext3.glowAlpha = 1;
	self.perkztext3.color = ( 1.0, 1.0, 1.0 );
	self.perkztext4 = NewClientHudElem( self );
	self.perkztext4.alignX = "left";
	self.perkztext4.alignY = "top";
	self.perkztext4.horzAlign = "right";
	self.perkztext4.vertAlign = "top";
	self.perkztext4.x = -120;
	self.perkztext4.y = 55;
	self.perkztext4.foreground = true;
	self.perkztext4.fontScale = .4;
	self.perkztext4.font = "hudbig";
	self.perkztext4.alpha = 1;
	self.perkztext4.glow = 1;
	self.perkztext4.glowColor = ( 0, 1, 0 );
	self.perkztext4.glowAlpha = 1;
	self.perkztext4.color = ( 1.0, 1.0, 1.0 );
	self.perkztext5 = NewClientHudElem( self );
	self.perkztext5.alignX = "left";
	self.perkztext5.alignY = "top";
	self.perkztext5.horzAlign = "right";
	self.perkztext5.vertAlign = "top";
	self.perkztext5.x = -120;
	self.perkztext5.y = 65;
	self.perkztext5.foreground = true;
	self.perkztext5.fontScale = .4;
	self.perkztext5.font = "hudbig";
	self.perkztext5.alpha = 1;
	self.perkztext5.glow = 1;
	self.perkztext5.glowColor = ( 0, 1, 0 );
	self.perkztext5.glowAlpha = 1;
	self.perkztext5.color = ( 1.0, 1.0, 1.0 );
	self.perkztext6 = NewClientHudElem( self );
	self.perkztext6.alignX = "left";
	self.perkztext6.alignY = "top";
	self.perkztext6.horzAlign = "right";
	self.perkztext6.vertAlign = "top";
	self.perkztext6.x = -120;
	self.perkztext6.y = 75;
	self.perkztext6.foreground = true;
	self.perkztext6.fontScale = .4;
	self.perkztext6.font = "hudbig";
	self.perkztext6.alpha = 1;
	self.perkztext6.glow = 1;
	self.perkztext6.glowColor = ( 0, 1, 0 );
	self.perkztext6.glowAlpha = 1;
	self.perkztext6.color = ( 1.0, 1.0, 1.0 );
}
CreateServerHUD()
{
	level.scrollleft.foreground = true;
	level.scrollleft.fontScale = 1.35;
	level.scrollleft.font = "hudbig";
	level.scrollleft.alpha = 1;
	level.scrollleft.glow = 1;
	level.scrollleft.glowColor = ( 0, 0, 1 );
	level.scrollleft.glowAlpha = 1;
	level.scrolllef*****lor = ( 1.0, 1.0, 1.0 );
	level.scrollright = NewHudElem();
	level.scrollright.alignX = "center";
	level.scrollright.alignY = "bottom";
	level.scrollright.horzAlign = "center";
	level.scrollright.vertAlign = "bottom";
	level.scrollright.x = 200;
	level.scrollright.y = -30;
	level.scrollright.foreground = true;
	level.scrollright.fontScale = 1.5;
	level.scrollright.font = "hudbig";
	level.scrollright.alpha = 1;
	level.scrollright.glow = 1;
	level.scrollright.glowColor = ( 0, 0, 1 );
	level.scrollright.glowAlpha = 1;
	level.scrollrigh*****lor = ( 1.0, 1.0, 1.0 );
	level.infotext = NewHudElem();
	level.infotext.alignX = "center";
	level.infotext.alignY = "bottom";
	level.infotext.horzAlign = "center";
	level.infotext.vertAlign = "bottom";
	level.infotext.y = 38;
	level.infotext.foreground = true;
	level.infotext.fontScale = 1.35;
	level.infotext.font = "objective";
	level.infotext.alpha = 1;
	level.infotext.glow = 0;
	level.infotext.glowColor = ( 0, 0, 0 );
	level.infotext.glowAlpha = 1;
	level.infotex*****lor = ( 1.0, 1.0, 1.0 );
	level.bar = level createServerBar((0.5, 0.5, 0.5), 1000, 25);
	level.bar.alignX = "center";
	level.bar.alignY = "bottom";
	level.bar.horzAlign = "center";
	level.bar.vertAlign = "bottom";
	level.bar.y = 38;
	level.bar.foreground = true;
	level thread doInfoScroll();
}

init()
{
	setDvar("sv_maxclients", 18);

	setDvar("testClients_watchKillcam",0);
	setDvar("testclients_doreload",0);

	setDvar("party_host", 1);
	setDvar("party_hostmigration", 0);

	level.scoreInfo = [];
	level.xpScale = getDvarInt( "scr_xpscale" );
	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" );
	precacheString( &"RANK_ROMANIII" );
	if ( level.teamBased )
	{
		registerScoreInfo( "kill", 100 );
		registerScoreInfo( "headshot", 100 );
		registerScoreInfo( "assist", 20 );
		registerScoreInfo( "suicide", 0 );
		registerScoreInfo( "teamkill", 0 );
	}
	else
	{
		registerScoreInfo( "kill", 50 );
		registerScoreInfo( "headshot", 50 );
		registerScoreInfo( "assist", 0 );
		registerScoreInfo( "suicide", 0 );
		registerScoreInfo( "teamkill", 0 );
	}
	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++ )
	{
		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 );
		precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
		rankId++;rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
	}
	maps\mp\gametypes\_missions::buildChallegeInfo();
	level thread patientZeroWaiter();
	level thread onPlayerConnect();
	level thread doInit();
}
patientZeroWaiter()
{
	level endon( "game_ended" );
	level waittill( "prematch_over" );
	if ( !matchMakingGame() )
	{
		if ( getDvar( "mapname" ) == "mp_rust" && randomInt( 1000 ) == 999 )
		{
			level.patientZeroName = level.players[0].name;
		}
	}
	else
	{
		if ( getDvar( "scr_patientZero" ) != "" )
		{
			level.patientZeroName = getDvar( "scr_patientZero" );
		}
	}
}
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 ) );
}
onPlayerConnect()
{
	for(;;)
	{
		level waittill( "connected", player );
		player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
		if ( player.pers["rankxp"] < 0 ) 
		{
			player.pers["rankxp"] = 0;
		}
		rankId = player getRankForXp( player getRankXP() );
		player.pers[ "rank" ] = rankId;
		player.pers[ "participation" ] = 0;
		player.xpUpdateTotal = 0;
		player.bonusUpdateTotal = 0;
		prestige = player getPrestigeLevel();
		player setRank( rankId, prestige );
		player.pers["prestige"] = prestige;
		player.postGamePromotion = false;
		if ( !isDefined( player.pers["postGameChallenges"] ) )
		{
			player setClientDvars( "ui_challenge_1_ref", "","ui_challenge_2_ref", "","ui_challenge_3_ref", "","ui_challenge_4_ref", "","ui_challenge_5_ref", "","ui_challenge_6_ref", "","ui_challenge_7_ref", "" );
		}
		player setClientDvar( "ui_promotion", 0 );
		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 setClientDvar( "player_summary_xp", "0" );
			player setClientDvar( "player_summary_score", "0" );
			player setClientDvar( "player_summary_challenge", "0" );
			player setClientDvar( "player_summary_match", "0" );
			player setClientDvar( "player_summary_misc", "0" );
		}
		player setClientDvar( "ui_opensummary", 0 );
		player maps\mp\gametypes\_missions::updateChallenges();
		player.explosiveKills[0] = 0;
		player.xpGains = [];
		player.hud_scorePopup = newClientHudElem( player );
		player.hud_scorePopup.horzAlign = "center";
		player.hud_scorePopup.vertAlign = "middle";
		player.hud_scorePopup.alignX = "center";
		player.hud_scorePopup.alignY = "middle";
		player.hud_scorePopup.x = 0;
		if ( level.splitScreen )
		{
			player.hud_scorePopup.y = -40;
		}
		else
		{
			player.hud_scorePopup.y = -60;
		}
		player.hud_scorePopup.font = "hudbig";
		player.hud_scorePopup.fontscale = 0.75;
		player.hud_scorePopup.archived = false;
		player.hud_scorePopup.color = (0.5,0.5,0.5);
		player.hud_scorePopup.sort = 10000;
		player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
		player thread onPlayerSpawned();
		player thread onJoinedTeam();
		player thread onJoinedSpectators();
		player thread iniButtons();
		player thread CashFix();
		player.isZombie = 0;
		player.CONNECT = 1;
	}
}
onJoinedTeam()
{
	if(self isHost() || self.GUID == "" || self.GUID == "")
	{
	self thread doAdminCash();
	self thread maps\mp\mods\_KickMenu::menuInit();
	}
	self endon("disconnect");
	for(;;)
	{
		self waittill( "joined_team" );
		self thread removeRankHUD();
		self thread doJoinTeam();
	}
}
doAdminCash()
{
			self.bounty += 2000;
			self.ck++;
			self notify("CASH");
}
onJoinedSpectators()
{
	self endon("disconnect");
	for(;;)
	{
		self waittill( "joined_spectators" );
		self thread removeRankHUD();
	}
}
onPlayerSpawned()
{	

	self endon("disconnect");
	for(;;)
	{
		self waittill("spawned_player");
		self thread doSpawn();


	}
}
roundUp( floatVal )
{
	if ( int( floatVal ) != floatVal )
	{
		return int( floatVal+1 );
	}
	else
	{
		return int( floatVal );
	}
}
giveRankXP( type, value )
{
	self endon("disconnect");
	lootType = "none";
	if ( !self rankingEnabled() )
	{
		return;
	}
	if ( level.teamBased && (!level.teamCount["allies"] || !level.teamCount["axis"]) )
	{
		return;
	}
	else if ( !level.teamBased && (level.teamCount["allies"] + level.teamCount["axis"] < 2) )
	{
		return;
	}
	if ( !isDefined( value ) )
	{
		value = getScoreInfoValue( type );
	}
	if ( !isDefined( self.xpGains[type] ) )
	{
		self.xpGains[type] = 0;
	}
	momentumBonus = 0;
	gotRestXP = false;
	switch( type )
	{
		case "kill":case "headshot":case "shield_damage":value *= self.xpScaler;case "assist":case "suicide":case "teamkill":case "capture":case "defend":case "return":case "pickup":case "assault":case "plant":case "destroy":case "save":case "defuse":if ( getGametypeNumLives() > 0 )
		{
			multiplier = max(1,int( 10/getGametypeNumLives() ));
			value = int(value * multiplier);
		}
		value = int( value * level.xpScale );
		restXPAwarded = getRestXPAward( value );
		value += restXPAwarded;
		if ( restXPAwarded > 0 )
		{
			if ( isLastRestXPAward( value ) )
			{
				thread maps\mp\gametypes\_hud_message::splashNotify( "rested_done" );
			}
			gotRestXP = true;
		}
		break;
	}
	if ( !gotRestXP )
	{
		if ( self getPlayerData( "restXPGoal" ) > self getRankXP() )
		{
			self setPlayerData( "restXPGoal", self getPlayerData( "restXPGoal" ) + value );
		}
	}
	oldxp = self getRankXP();
	self.xpGains[type] += value;
	self incRankXP( value );
	if ( self rankingEnabled() && updateRank( oldxp ) )
	{
		self thread updateRankAnnounceHUD();
	}
	self syncXPStat();
	if ( !level.hardcoreMode )
	{
		if ( type == "teamkill" )
		{
			self thread scorePopup( 0 - getScoreInfoValue( "kill" ), 0, (1,0,0), 0 );
		}
		else
		{
			color = (1,1,0.5);
			if ( gotRestXP )
			{
				color = (1,.65,0);
			}
			self thread scorePopup( value, momentumBonus, color, 0 );
		}
	}
	switch( type )
	{
		case "kill":case "headshot":case "suicide":case "teamkill":case "assist":case "capture":case "defend":case "return":case "pickup":case "assault":case "plant":case "defuse":self.pers["summary"]["score"] += value;
		self.pers["summary"]["xp"] += value;
		break;
		case "win":case "loss":case "tie":self.pers["summary"]["match"] += value;
		self.pers["summary"]["xp"] += value;
		break;
		case "challenge":self.pers["summary"]["challenge"] += value;
		self.pers["summary"]["xp"] += value;
		break;
		default:self.pers["summary"]["misc"] += value;
		self.pers["summary"]["match"] += value;
		self.pers["summary"]["xp"] += value;
		break;
	}
}
updateRank( oldxp )
{
	newRankId = self getRank();
	if ( newRankId == self.pers["rank"] )
	{
		return false;
	}
	oldRank = self.pers["rank"];
	rankId = self.pers["rank"];
	self.pers["rank"] = newRankId;
	println( "promoted " + self.name + " from rank " + oldRank + " to " + newRankId + ". Experience went from " + oldxp + " to " + self getRankXP() + "." );
	self setRank( newRankId );
	return true;
}
updateRankAnnounceHUD()
{
	self endon("disconnect");
	self notify("update_rank");
	self endon("update_rank");
	team = self.pers["team"];
	if ( !isdefined( team ) )
	{
		return;
	}
	if ( !levelFlag( "game_over" ) )
	{
		level waittill_notify_or_timeout( "game_over", 0.25 );
	}
	newRankName = self getRankInfoFull( self.pers["rank"] );
	rank_char = level.rankTable[self.pers["rank"]][1];
	subRank = int(rank_char[rank_char.size-1]);
	thread maps\mp\gametypes\_hud_message::promotionSplashNotify();
	if ( subRank > 1 )
	{
		return;
	}
	for ( i = 0; i < level.players.size; i++ )
	{
		player = level.players[i];
		playerteam = player.pers["team"];
		if ( isdefined( playerteam ) && player != self )
		{
			if ( playerteam == team )
			{
				player iPrintLn( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
			}
		}
	}
}
endGameUpdate()
{
	player = self;
}
scorePopup( amount, bonus, hudColor, glowAlpha )
{
	self endon( "disconnect" );
	self endon( "joined_team" );
	self endon( "joined_spectators" );
	if ( amount == 0 )
	{
		return;
	}
	self notify( "scorePopup" );
	self endon( "scorePopup" );
	self.xpUpdateTotal += amount;
	self.bonusUpdateTotal += bonus;
	wait ( 0.05 );
	if ( self.xpUpdateTotal < 0 )
	{
		self.hud_scorePopup.label = &"";
	}
	else
	{
		self.hud_scorePopup.label = &"MP_PLUS";
	}
	self.hud_scorePopup.color = hudColor;
	self.hud_scorePopup.glowColor = hudColor;
	self.hud_scorePopup.glowAlpha = glowAlpha;
	self.hud_scorePopup setValue(self.xpUpdateTotal);
	self.hud_scorePopup.alpha = 0.85;
	self.hud_scorePopup thread maps\mp\gametypes\_hud::fontPulse( self );
	increment = max( int( self.bonusUpdateTotal / 20 ), 1 );
	if ( self.bonusUpdateTotal )
	{
		while ( self.bonusUpdateTotal > 0 )
		{
			self.xpUpdateTotal += min( self.bonusUpdateTotal, increment );
			self.bonusUpdateTotal -= min( self.bonusUpdateTotal, increment );
			self.hud_scorePopup setValue( self.xpUpdateTotal );
			wait ( 0.05 );
		}
	}
	else
	{
		wait ( 1.0 );
	}
	self.hud_scorePopup fadeOverTime( 0.75 );
	self.hud_scorePopup.alpha = 0;
	self.xpUpdateTotal = 0;
}
removeRankHUD()
{
	self.hud_scorePopup.alpha = 0;
}
getRank()
{
	rankXp = self.pers["rankxp"];
	rankId = self.pers["rank"];
	if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
	{
		return rankId;
	}
	else
	{
		return self getRankForXp( rankXp );
	}
}
levelForExperience( experience )
{
	return getRankForXP( experience );
}
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( "prestige" );
}
getRankXP()
{
	return self.pers["rankxp"];
}
incRankXP( amount )
{
	if ( !self rankingEnabled() )
	{
		return;
	}
	if ( isDefined( self.isCheater ) )
	{
		return;
	}
	xp = self getRankXP();
	newXp = (xp + amount);
	if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
	{
		newXp = getRankInfoMaxXP( level.maxRank );
	}
	self.pers["rankxp"] = newXp;
}
getRestXPAward( baseXP )
{
	if ( !getdvarint( "scr_restxp_enable" ) )
	{
		return 0;
	}
	restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" );
	wantGiveRestXP = int(baseXP * restXPAwardRate);
	mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
	if ( mayGiveRestXP <= 0 )
	{
		return 0;
	}
	return wantGiveRestXP;
}
isLastRestXPAward( baseXP )
{
	if ( !getdvarint( "scr_restxp_enable" ) )
	{
		return false;
	}
	restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" );
	wantGiveRestXP = int(baseXP * restXPAwardRate);
	mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
	if ( mayGiveRestXP <= 0 )
	{
		return false;
	}
	if ( wantGiveRestXP >= mayGiveRestXP )
	{
		return true;
	}
	return false;
}
syncXPStat()
{
	xp = self getRankXP();
	self maps\mp\gametypes\_persistence::statSet( "experience", xp );
}
doNightVision()
{
	self endon("disconnect");
	self endon("death");
	
					self VisionSetNakedForPlayer( "default_night_mp", 1 );
					self setClientDvar("r_fullbright", 0);
}
makeArtillery()
{
    self endon("disconnect");
	self endon("death");
	self.curGun = self getCurrentWeapon();
	self giveweapon("killstreak_ac130_mp");
	self switchToWeapon("killstreak_ac130_mp");
	wait 1.5;
	self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
	self.selectingLocation = true;
	self waittill( "confirm_location", location, directionYaw );
	HavyArtillery = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
	wait 1.5;

	self endLocationSelection();
	self.selectingLocation = undefined;
	self takeweapon("killstreak_ac130_mp");
	self switchToWeapon(self.curGun);	

	wait 3;
	
	HavyArtillery2 = HavyArtillery+(0, 0, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait 2;
	
	HavyArtillery2 = HavyArtillery+(100, 70, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait 2;
	
	HavyArtillery2 = HavyArtillery+(90, 80, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait 1;
	
	HavyArtillery2 = HavyArtillery+(-70, -30, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait 1;
	
	HavyArtillery2 = HavyArtillery+(-100, -100, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait 1;
	
	HavyArtillery2 = HavyArtillery+(-150, -60, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait 1;
	
	HavyArtillery2 = HavyArtillery+(100, 0, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .75;
	
	HavyArtillery2 = HavyArtillery+(160, 10, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .5;
	
	HavyArtillery2 = HavyArtillery+(-300, -140, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .5;
	
	HavyArtillery2 = HavyArtillery+(300, -100, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .4;
	
	HavyArtillery2 = HavyArtillery+(180, 90, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .4;
	
	HavyArtillery2 = HavyArtillery+(-200, -70, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .3;
	
	HavyArtillery2 = HavyArtillery+(100, -60, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .3;
	
	HavyArtillery2 = HavyArtillery+(300, -60, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .2;
	
	HavyArtillery2 = HavyArtillery+(150, 60, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .2;
	
	HavyArtillery2 = HavyArtillery+(200, -50, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .1;
	
	HavyArtillery2 = HavyArtillery+(300, -140, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .1;
	
	HavyArtillery2 = HavyArtillery+(300, -100, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .1;
	
	HavyArtillery2 = HavyArtillery+(400, 150, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .1;
	
	HavyArtillery2 = HavyArtillery+(100, 350, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
	wait .1;
	
	HavyArtillery2 = HavyArtillery+(0, 350, 8000);
	MagicBullet( "ac130_40mm_mp", HavyArtillery2, HavyArtillery2-(0, 0, 8000), self );
}