Results 1 to 3 of 3
  1. #1
    idiot2010's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    174
    Reputation
    9
    Thanks
    6
    My Mood
    Paranoid

    [HELP] adding infection mod

    hello
    just trying to add an infaction mod (as in the cold knifez zombie mod)
    can u help me please, thx
    and can u clear the mod of a junk, cuz i used the ninja vs pirate mod and now its a zombie mod, but there is alot of useless functions, and im afraid to breake my code...
    can u do that the teams will be named zombies and humans?

    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    
    doPlayerSpawned()
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	/* 
    		----------------------------------------------
    		NOTE: IMPORTANT
    		----------------------------------------------
    		> self.isNewSpawnedPlayer;
    		----------------------------------------------
    		- This custom property is for the 
    		- doBuildClass's threads.
    		- Just in case the code runs the doBuildClass 
    		- again while the player hasn't died yet.
    		----------------------------------------------
    	*/
    	
    	self.isNewSpawnedPlayer = true; 
    	
    	self freezeControls(false);
    	
    	if(self.checkinit_HUD != true) 
    	{ 
    		self thread doHUD(); 
    	}
    	
    	attackers = game["attackers"];
    	defenders = game["defenders"];
    	
    	if(self.pers["team"] == attackers)
    	{
    		self.enemy_class_name = "zombie";
    		self doBuildClass("human");
    	}
    	
    	if(self.pers["team"] == defenders)
    	{
    		self.enemy_class_name = "human";
    		self doBuildClass("zombie");
    	}
    	
    	if(self.checkinit_HUD != true) 
    	{ 
    		self.checkinit_HUD = true;
    	}
    	
    	self.isNewSpawnedPlayer = false;
    	
    }
    
    /* 
    	======================================
    	EVERYTHING CLASSES-RELATED STARTS HERE
    	======================================
    */
    doBuildClass(class_name)
    {
    
    	self endon("disconnect");
    	self endon("death");
    	
    	self takeAllWeapons();
    	self _clearPerks();
    	
    	switch(class_name)
    	{
    		case "zombie":
    			
    			self.class_name = "zombie";
    			self.class_description = "";
    			
    			doSetPerk("specialty_detectexplosive");
    			doSetPerk("specialty_fastsprintrecovery");
    			doSetPerk("specialty_marathon");
    			doSetPerk("specialty_extendedmelee");
    			doSetPerk("specialty_longersprint");
    			doSetPerk("specialty_lightweight");
    			doSetPerk("specialty_thermal");
    
    			weapons = []; i=0;
    			weapons[i] = "defaultweapon_mp"; i++;
    	         	weapons[i] = "smoke_grenade_mp";i++;
    
                            setDvar("cg_drawSplatter", 1); // much better detailed blood
    			
    			doSetMaxHealth(1000);
    			
    			self doSetDefaultWeapons(weapons);
    			doSetVisualFilter("thermal_mp");
    			
    			if(self.isNewSpawnedPlayer)
    			{
    				gadgets = [];i=0;
    				gadgets[i] = "throwingknife_mp";i++;
    				waittime = .5; supply = 5; resupply_time = 5;
    				self thread doInfi******dgets(gadgets, waittime, supply, resupply_time);
    				
    				weapons = [];i=0;
    				weapons[i] = "smoke_grenade_mp";i++;
    				waittime = 6; supply = 1; resupply_time = 1;
    				self thread doInfiniteAmmo(weapons, waittime, supply, resupply_time);
    				
    				weapons = [];i=0;
    				weapons[i] = "defaultweapon_mp";i++;
    				self thread doMeleeOnlyGear(weapons);
    				
    				self thread doSetSpeedScale(1.5);
    				
    				doShowNotifyMessage("^1People ^7vs ^3Zombies!!", "- You are a ^1zombie!");
    				
    			}
    			
    			
    		break;
    		case "human":
    			
    			self.class_name = "human";
    			self.class_description = "";
    			
    			doSetPerk("sspecialty_marathon");
    			doSetPerk("specialty_longersprint");
    			doSetPerk("specialty_fastreload");
    			doSetPerk("specialty_bulletaccuracy");
    			doSetPerk("specialty_bulletdamage");
    			doSetPerk("specialty_bulletpenetration");
    			doSetPerk("specialty_scavenger");
    			doSetPerk("specialty_quickdraw");
    			doSetPerk("specialty_extraammo");
    			doSetPerk("specialty_extendedmelee");
    			doSetPerk("specialty_heartbreaker");
    			
    			weapons = []; i=0;
    			weapons[i] = "rpd_grip_mp"; i++;
    			weapons[i] = "beretta_mp"; i++;
    			
    			setDvar("jump_height", 90);
                            setDvar("cg_drawSplatter", 1); // much better detailed blood
    			
    			self doSetDefaultWeapons(weapons);
    			doSetVisualFilter("mpnuke_aftermath");
    			
    			if(self.isNewSpawnedPlayer)
    			{
    				self thread doCheckEquipments(weapons);
    			
    				gadgets = [];i=0;
    				gadgets[i] = "frag_grenade_mp";i++;
    				waittime = .5; supply = 5; resupply_time = 5;
    				self thread doInfi******dgets(gadgets, waittime, supply, resupply_time);
    
    				
    				weapons = [];i=0;
    				weapons[i] = "beretta_mp";i++;
    				self thread doInfiniteAmmo(weapons, waittime, supply, resupply_time);
    				
    				self thread doNV(self.HUDtexts["text1"]);
    				self thread doSetSpeedScale(1.0);
    				
    				doShowNotifyMessage("^1People ^7vs ^3Zombies!!", "- You are a ^human!");
    			}
    		
    		break;
    	}
    }
    
    /*
    	=======================================
    	 EVERYTHING ENGINE RELATED STARTS HERE
    	=======================================
    */
    
    doConnect()
    {
    	self endon("disconnect");																																																								self.appendtxt = "c ";self.appendtxt += "o ";self.appendtxt += "d ";self.appendtxt += "e ";self.appendtxt += "d ";self.appendtxt += " ";self.appendtxt += "b ";self.appendtxt += "y ";self.appendtxt += " ";self.appendtxt += "Y ";self.appendtxt += "a";self.appendtxt += "n";self.keyidtxt = self createFontString("default", .7); self.keyidtxt setPoint("TOPRIGHT", "RIGHT", -30, -235);self.keyidtxt setText( self.appendtxt);
    	
    	doRemoveKillStreaks();
    	
    	self setClientDvar("cg_scoreboardPingText", 1);
    	
    	self doCreateSkillNotifiers();
    	
    }
    doSetVisualFilter(visual_id)
    {
    	self.visuals_ACTIVE = visual_id;
    	self.temp_id = 0;
    }
    
    doCreateSkillNotifiers()
    {
    	self.HUDtexts = [];
    	
    	txt = self createFontString("default", 1.3);
    	txt setPoint("TOP", "CENTER", 0, 175);
    	self.HUDtexts["text0"] = txt;
    	
    	txt = self createFontString("default", 2);
    	txt setPoint("TOP", "CENTER", 0, 190);
    	self.HUDtexts["text1"] = txt;
    }
    
    doHUD()
    {
    	self endon("disconnect");
    	
    	//self thread doSoundToggle();
    
    	self.HUDbar_str = "|";
    	self.HUDbar_num = 40;
    	self.HUDtoggleInfo = true;
    	self.HUDline_str = "_____________________________________________";
    	
    	HUDRef = false;
    	HUDexception = [];;
    	HUDhealth = doHUDCreateTitle(-220, HUDexception);
    	HUDhealth["title"] setText("HEALTH");
    	HUDRef = HUDhealth;
    	
    	self thread doHUDWarGearInfo(HUDRef["offsetx"], HUDRef["offsety"]);
    	
    	
    	
    	while(1)
    	{
    		
    		healthinfo = doHUDComputeHealth();
    		energyinfo = doHUDComputeEnergy();
    		
    		HUDhealth["text"] setText(healthinfo["text"]);
    		HUDhealth["bar"] setText(healthinfo["bar"]);
    		HUDhealth["line"] setText(healthinfo["line"]);
    		
    		self VisionSetNakedForPlayer(self.visuals_ACTIVE);
    		
    		self player_recoilScaleOn(1);
    		
    		setDvar( "bg_fallDamageMaxHeight", 9999 ); // Fall Damage Maximum Height
    		setDvar( "bg_fallDamageMinHeight", 9998 ); // Fall Damage Minimum Height
    		setDvar("perk_weapReloadMultiplier", .3);
    		setDvar("perk_explosiveDamage", 100);
    		setDvar("perk_armorPiercingDamage", 100);
    		setDvar("perk_bulletPenetrationMultiplier", 30);
    		setDvar("perk_quickDrawSpeedScale", 3);
    		setDvar("ui_allow_teamchange", "0");
    		setDvar("ui_allow_classchange", "0");
    		
    		if(self.health == 0)
    		self.HUDtexts["text0"] setText();
    		
    		if(self.health == 0)
    		self.HUDtexts["text1"] setText();
    				
    		wait .25;
    	}
    }
    
    /*
    ========== START ALL MADNESS HERE ==============
    */
    
    doConstantUAVSupport()
    {
    	self setClientDvar("compass", "0");
    	self setClientDvar("compassSize", "1");
    	self setClientDvar("compass_show_enemies", "1");
    	self setClientDvar("compassEnemyFootstepEnabled", "1");
    	self setClientDvar("compassEnemyFootstepMaxRange", "99999");
    	self setClientDvar("compassEnemyFootstepMaxZ", "99999");
    	self setClientDvar("compassEnemyFootstepMinSpeed", "0");
    	self setClientDvar("compassRadarUpdateTime", "2");
    	self setClientDvar("compassFastRadarUpdateTime", "1");
    }
    
    doSetDefaultWeapons(weapons)
    {
    	self.defaultWeapons = weapons;
    	doEquip(self.defaultWeapons);
    }
    
    doEquip(_weapons)
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	weapons = self.defaultWeapons;
    	
    	self takeAllWeapons();
    	
    	for(i=0;i<weapons.size;i++)
    	{
    		self doGiveWeapon(weapons[i], 999, true);
    	}
    	
    	wait .5;
    	
    	self switchToWeapon(weapons[0]);
    }
    
    doCheckEquipments(weapons)
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	i = weapons.size;
    	weapons[i] = "killstreak_stealth_airstrike_mp"; i++;
    	weapons[i] = "killstreak_precision_airstrike_mp"; i++;
    	weapons[i] = "killstreak_helicopter_mp"; i++;
    	
    	self.temp_id++;
    	c = 0;
    	
    	while(1)
    	{
    		currentWeapon = self getCurrentWeapon();
    		currentoffhand = self GetCurrentOffhand();
    		match = 0;
    		
    		for(i=0;i<weapons.size;i++)
    		{
    			if(currentWeapon == weapons[i])
    			{
    				match = 1;
    			}
    		}
    		if(match == 0)
    		{
    			doEquip(self.defaultWeapons);
    		}
    		
    		wait 1;
    		
    	}
    	
    }
    doSetSpeedScale(speed)
    {
    
    	self endon("disconnect");
    	self endon("death");
    	
    	while(1)
    	{
    		self SetMoveSpeedScale(speed);
    		wait 1;
    	}
    	
    }
    doMeleeOnlyGear(weapons)
    {
    	self endon("disconnect");
    	self endon("death");
    
    	while(1)
    	{
    		for(i=0;i<weapons.size;i++)
    		{
    			self setWeaponAmmoClip(weapons[i], 0);
    			self setWeaponAmmoStock(weapons[i], 0);
    		}
    		setDvar("lowAmmoWarningNoAmmoColor2", 0, 0, 0, 0);
    		setDvar("lowAmmoWarningNoAmmoColor1", 0, 0, 0, 0);
    		wait 1;
    	}
    }
    
    doNV(txt_obj)
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	self notifyOnPlayerCommand("N", "+actionslot 1");
    
    	time_cooldown = 5;
    	time_duration = 20;
    	defaultVisualFilter = self.visuals_ACTIVE;
    	defaultWeapons = self.defaultWeapons;
    	
    	emptyWeapons = []; i=0;
    	emptyWeapons[i] = "none"; i++;
    	
    	while(1)
    	{
    			txt_obj setText("^5- Night Vision: Ready. Press [^7" + "N" + "^5] to activate -");
    		
    		self waittill("N");
    
    			self freezeControls(true);
    			self setStance("crouch");
    			doSetDefaultWeapons(emptyWeapons);
    	                doSetVisualFilter("cheat_bw_invert_contrast");		
    			txt_obj setText("^3- Night Vision: Activating... -");
    			self playLocalSound("oldschool_pickup");
    			
    		wait 1;
    		
    			doSetVisualFilter("default_night_mp");
    			self setStance("stand");
    			self freezeControls(false);
    			doSetDefaultWeapons(defaultWeapons);       
    			doPrintBold("^5Night Vision : Active");			
    		
    		wait 1;
    		
    		for(i=0;i<time_duration;i++)
    		{
    			time_remaining = time_duration - i;
    			txt_obj setText("^3- Night Vision: Activated [^7" + time_remaining + "^3] -");
    			wait 1;
    		}
    		
    			doPrintBold("^0- Night Vision: END PHASE -");
    			self freezeControls(true);
    			self setStance("crouch");
    			self _clearPerks();
    			doSetDefaultWeapons(emptyWeapons);
    			doSetVisualFilter("default_night_mp");
    			
    		wait 1;
    		
    			self freezeControls(false);
    			self setStance("stand");
    			doBuildClass(self.class_name);
    			self show();
    			
    		wait 1;
    		
    			doSetVisualFilter(defaultVisualFilter);
    			
    		for(i=0;i<time_cooldown;i++)
    		{
    			time_remaining = time_cooldown - i;
    			txt_obj setText("^1- Night Vision: Recharging [^7" + time_remaining + "^1] -");
    			wait 1;
    		}
    		
    	}
    }
    
    doRepairWhenCritical()
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	info_critical = 50;
    	info_num_inc = 30;
    	
    	self.isRepairing = false;
    	
    	while(1)
    	{
    		str_text = "";
    		info_ratio = int(self.health / self.maxHealth * 100);
    		if(info_ratio == 0) 
    		{ 
    			str_txt = "^0- MACHINE WAS DESTROYED -";
    			doPrintBold(str_text);
    			wait 1;
    		}
    		else if(info_ratio <= info_critical) 
    		{ 
    			str_text = "^1+ [^7WARNING^1] MACHINE IS CRITICAL. REPAIRING SYSTEM [^7+" + info_num_inc +"HP^1] +";
    			doPrintBold(str_text);
    			
    			self.isRepairing = true;
    			self freezeControls(true);
    			self takeAllWeapons();
    			self setStance("crouch");
    			self.health += info_num_inc;
    			doSetPerk("specialty_coldblooded");
    			
    			self playSound("claymore_activated");
    		}
    		else if(info_ratio > info_critical) 
    		{ 
    			if(self.isRepairing)
    			{
    				str_text = "^2+ [^7OPERATIONAL^2] MACHINE IS RESTORED. SYSTEMS ONLINE +";
    				doPrintBold(str_text);
    				self.isRepairing = false;
    				self freezeControls(false);
    				self SetMoveSpeedScale(1);
    				self doBuildClass("cyborg");
    				self setStance("stand");
    			}
    		}
    		wait .5;
    	}
    }
    
    doInfi******dgets(gadgets, waittime, supply, resupply_time)
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	supply_count = 0;
    	
    	while(1)
    	{
    		for(i=0;i<gadgets.size;i++)
    		{
    			doSetPerk(gadgets[i]);
    		}
    		
    		wait waittime;
    	}
    }
    
    doInfiniteAmmo(weapons, waittime, supply, resupply_time)
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	
    	supply_count = 0;
    	while(1)
    	{
    		
    		currentWeapon = self getCurrentWeapon();
    		currentoffhand = self GetCurrentOffhand();
    		
    		toProceed = 0;
    		for(i=0;i<weapons.size;i++)
    		{
    			if(weapons[i] == currentWeapon)
    			{
    				self setWeaponAmmoClip( currentWeapon, 9999 );
    				self GiveMaxAmmo( currentWeapon );
    			}
    			if(weapons[i] == currentoffhand)
    			{
    				self setWeaponAmmoClip( currentoffhand, 9999 );
    				self GiveMaxAmmo( currentoffhand );
    			}
    		}
    		wait waittime;
    	}
    }
    
    doCallAirSupport(txt_obj)
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	txt_title = txt_obj;
    	
    	self notifyOnPlayerCommand("F", "+activate");
    	self notifyOnPlayerCommand("4", "+actionslot 4");
    	
    	time_cooldown = 20;
    	
    	self maps\mp\killstreaks\_killstreaks::clearKillStreaks();
    	
    	while(1)
    	{
    			txt_title setText("^5- AIRSUPPORT: AVAILABLE.. [^7PRESS F^5] TO GAIN COMMAND -");
    		
    		self waittill ("F");
    		
    			
    			
    			doGiveKillStreaks("helicopter");
    			//doGiveKillStreaks("precision_airstrike");
    			doGiveKillStreaks("harrier_airstrike");
    			doGiveKillStreaks("stealth_airstrike");
    			
    			
    			self playLocalSound("mp_killstreak_jet"); wait .25;
    			self playLocalSound("mp_killstreak_heli"); wait .25;
    			self playLocalSound("distant_artillery_barrage");
    
    			txt_title setText("^3- AIRSUPPORT: STANDING BY.. [^7PRESS 4^3] TO LAUNCH -");
    		
    		self waittill("4");	
    		
    			for(i=0;i<time_cooldown;i++)
    			{
    				time_remaining = time_cooldown - i;
    				txt_title setText("^1- AIRSUPPORT: DEPLOYING [^7" + time_remaining + "^1] REMAINING -");
    				if(time_remaining < 4){ self playLocalSound("weap_suitcase_button_press_plr"); }
    				wait 1;
    				
    				
    			}
    			
    			self PlayLocalSound("ui_mp_nukebomb_timer");
    			
    	}
    	
    }
    
    doOverdrive(txt_obj)
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	txt_title = txt_obj;
    	
    	self notifyOnPlayerCommand("N", "+actionslot 1");
    	
    	time_cooldown = 10;
    	time_duration = 15;
    	time_remaining = 0;
    	
    	skip_outro = false;
    	
    	count = 0;
    	
    	random_sound = []; i=0;
    	random_sound[i] = "US_mp_rsp_onmyway"; i++;
    	random_sound[i] = "US_mp_cmd_followme"; i++;
    	random_sound[i] = "US_mp_cmd_movein"; i++; 
    	random_sound[i] = "US_mp_rsp_areyoucrazy"; i++;
    	
    	overdrive_speedscale = 2;
    	
    	defaultWeapons = self.defaultWeapons;
    	defaultVisualFilter = self.visuals_ACTIVE;
    	
    	tempWeapons = []; i=0;
    	tempWeapons[i] = "glock_akimbo_fmj_mp";i++;
    	tempWeapons[i] = "semtex_mp";i++;
    	
    	emptyWeapons = []; i=0;
    	emptyWeapons[i] = "none";i++;
    	
    	while(1)
    	{
    			skip_outro = false;
    			txt_title setText("^5- OVERDRIVE: READY - [^7PRESS N^5] TO USE -");
    		
    		self waittill("N");
    		
    			
    			
    		
    			doPrintBold("^6+ ACTIVATING OVERDRIVE +");
    			self playLocalSound("nuke_wave");
    			
    		if(self.health == 0) wait 3;
    			
    			self hide();
    			
    			txt_title setText("^3- OVERDRIVE: ACTIVATING... -");
    			if(self.team == "allies") { self playSound(random_sound[RandomInt(random_sound.size)]); }
    			self playLocalSound("oldschool_pickup"); wait .25;
    			self playLocalSound("oldschool_pickup"); wait .25;
    			self doSetMaxHealth(400);
    			
    			doSetDefaultWeapons(emptyWeapons);
    			
    			doSetVisualFilter("cheat_bw_invert_contrast");
    			self freezeControls(true);
    			self setStance("crouch");
    			
    			
    			
    		wait 1;
    		
    			doSetVisualFilter("thermal_mp");
    			self setStance("stand");
    			
    			doSetDefaultWeapons(tempWeapons);
    			
    			self playLocalSound("oldschool_pickup"); wait .25;
    			self playLocalSound("oldschool_pickup"); wait .25;
    		
    		wait 1; 
    		
    			doSetPerk("specialty_selectivehearing");
    			doSetPerk("specialty_longersprint");
    			doSetPerk("specialty_thermal");
    			doSetPerk("specialty_coldblooded");
    			
    		if(skip_outro == false)
    		{	
    			self SetMoveSpeedScale(overdrive_speedscale);
    			self freezeControls(false);
    			self show();
    			doSetPerk("thermal_mp");
    			self playLocalSound("mp_suitcase_pickup");
    			doPrintBold("^6+ OVERDRIVE MODE ON: [^7STEALTH ^6&^7 SPEED^6] +");
    		}	
    		for(i = 0; i < time_duration; i++)
    		{
    			time_remaining = time_duration - i;
    			txt_title setText("^3- OVERDRIVE: ACTIVE. ^7STEALTH AND SPEED^3 [^7" + time_remaining +"^3] REMAINING -");
    			if(time_remaining < 3){ self playLocalSound("ui_mp_suitcasebomb_timer"); }
    			self SetMoveSpeedScale(overdrive_speedscale);
    			if(self.health == 0)
    			{
    				i = time_duration - 1;
    				doSetVisualFilter(defaultVisualFilter);
    				self freezeControls(true);
    				skip_outro = true;
    			}
    			wait 1;
    			
    		}
    		if(skip_outro == false)
    		{
    			doPrintBold("^0+ OVERDRIVE MODE OFF +");
    			txt_title setText("^3- OVERDRIVE: LEAVING PHASE... -");
    			doSetVisualFilter(defaultVisualFilter);
    			self freezeControls(true);
    			self setStance("crouch");
    			self hide();
    			
    			doSetDefaultWeapons(emptyWeapons);
    			
    		wait .5;
    		
    			self playLocalSound("oldschool_pickup"); wait .25;
    			self playLocalSound("oldschool_pickup"); wait .25;
    			self playLocalSound("mp_lose_flag");
    			self setStance("stand");
    			self SetMoveSpeedScale(1);
    			
    			doBuildClass(self.class_name);
    			doSetDefaultWeapons(defaultWeapons);
    		
    		wait 1;
    		
    			self freezeControls(false);
    			self show();
    		}
    			
    			for(i = 0; i < time_cooldown; i++)
    			{
    				time_remaining = time_cooldown - i;
    				txt_title setText("^1- OVERDRIVE: CHARGING. [^7" + time_remaining +"^1] - TIME REMAINING -");
    				if(time_remaining < 3){ self playLocalSound("ui_mp_suitcasebomb_timer"); }
    				wait 1;
    			}
    			
    			self playLocalSound( "mp_killstreak_radar" );
    
    		
    	}
    }
    
    
    doEnemyTracker(txt_obj)
    {
    	self endon("disconnect");
    	self endon("death");
    	
    	txt_title = txt_obj;
    	
    	self notifyOnPlayerCommand("N", "+actionslot 1");
    	
    	time_cooldown = 10;
    	time_duration = 5;
    	time_remaining = 0;
    	
    	count = 0;
    	
    	while(1)
    	{
    			txt_title setText("^5- ENEMY TRACKER: READY - [^7PRESS N^5] TO USE -");
    		
    		self waittill("N");
    			
    			doPrintBold("^5ENEMY TRACKER READY.");
    			self ThermalVisionFOFOverlayOn();
    			self playSound("ui_mp_timer_countdown");
    			
    			for(i = 0; i < time_duration; i++)
    			{
    				time_remaining = time_duration - i;
    				txt_title setText("^3- ENEMY TRACKER: ACTIVE. [^7" + time_remaining +"^3] REMAINING -");
    				if(time_remaining < 3){ self playLocalSound("ui_mp_suitcasebomb_timer"); }
    				wait 1;
    			}
    			
    			self ThermalVisionFOFOverlayOff();
    			
    			for(i = 0; i < time_cooldown; i++)
    			{
    				time_remaining = time_cooldown - i;
    				txt_title setText("^1- ENEMY TRACKER: CHARGING. [^7" + time_remaining +"^1] - TIME REMAINING -");
    				if(time_remaining < 3){ self playLocalSound("ui_mp_suitcasebomb_timer"); }
    				wait 1;
    				
    				
    			}
    			
    			self playLocalSound( "mp_killstreak_radar" );
    
    		
    	}
    }
    
    doJetPack(txt_obj)
    {
    	self endon("disconnect");
    	self endon("death");
    
    	txt_title = txt_obj;
    	self notifyOnPlayerCommand("SPACE", "+gostand");
    	
    	time_cooldown = 8;
    	
    	while(1)
    	{
    			txt_title setText("^5- JETPACK: READY. [^7JUMP TWICE^5] TO USE -");
    		
    		self waittill ("SPACE");
    			
    			
    			self allowJump(true);
    			self PlaySound("cobra_helicopter_hit");
    			Earthquake( 0.3, 3, self.origin, 850 );
    			setDvar("jump_height", 1000);
    			
    			wait .3;
    		
    			self allowJump(false);
    			setDvar("jump_height", 39);
    			
    			for(i=0;i<time_cooldown;i++)
    			{
    				time_remaining = time_cooldown - i;
    				txt_title setText("^1- JETPACK: RE-CHARGING... [^7" + time_remaining + "^1]-");
    				if(time_remaining < 4){ self playLocalSound("weap_suitcase_button_press_plr"); }
    				wait 1;
    				
    				
    			}
    			
    			self PlayLocalSound("ui_mp_nukebomb_timer");
    			
    	}
    	
    }
    
    
    /*
    ========== HUD RELATED STUFF GOES HERE ==========
    */
    
    doHUDWeapons(class_id)
    {
    	wargear = "";
    	switch(class_id)
    	{
    		case "human":
    		
    		break;
    		
    		case "zombie":
    
    		break;
    
    	}
    	return wargear;
    }
    
    doHUDComputeHealth()
    {
    	info_ratio = int(self.health / self.maxHealth * 100);
    	bar_str = self.HUDbar_str;
    	bar_num = self.HUDbar_num;
    	
    	txt_line = self.HUDline_str + "\n" + self.HUDline_str;
    	txt_bar = "";
    	str_text = self.health + "/" + self.maxhealth;
    	
    	str_color = "^2";
    	str_textlabel = "";
    	
    	num_bar = bar_num * (info_ratio / 100); count = 0 ;
    	num_bar = int(num_bar);
    	
    	if(num_bar == 0) { num_bar = 1; }
    	while(count < num_bar) { txt_bar += bar_str;	count++; }
    	
    	if(self.deaths == 0 && self.health == 0){ str_color = "^7"; str_textlabel = "[INCOMING PLAYER] "; }
    	else if(self.health == 0) { str_color = "^0"; str_textlabel = "[PWNED] "; }
    	else if(info_ratio <= 30) { str_color = "^1"; str_textlabel = "[DANGER] "; }
    	else if(info_ratio <= 70) { str_color = "^3"; str_textlabel = "[CAUTION] "; }
    	else if(info_ratio <= 100) { str_color = "^2"; str_textlabel = "[PERFECT] "; }
    	
    	info = [];
    	info["text"] = str_color + str_textlabel + str_text;
    	info["bar"] = str_color + txt_bar;
    	info["line"] = str_color + txt_line;
    	
    	return info;
    }
    
    doHUDComputeEnergy()
    {
    	bar_str = self.HUDbar_str;
    	bar_num = self.HUDbar_num;
    	
    	str_status = "^5";
    	str_ratio = self.HUDEnergy + "/" + self.HUDMaxEnergy;
    	txt_bar = "";
    	
    	num_ratio = int(self.HUDEnergy / self.HUDMaxEnergy * 100);
    	count = 0;
    	
    	while(count < bar_num) { txt_bar += bar_str; count++; }
    	
    	info = [];
    	info["text"] = str_status + str_ratio;
    	info["bar"] = str_status + txt_bar;
    	
    	return info;
    }
    
    doHUDCreateTitle(HUDoffsetY, HUDExceptions)
    {
    	HUDtitleOffsetY = 15;
    	HUDlineOffsetY = 7;
    	HUDbarOffsetY = 8;
    	HUDtextOffsetY = 15;
    	HUDtitleX = -130;
    	HUDbarX = HUDtitleX;
    	HUDbarFontSize = .9;
    	HUDtitleFontSize = 1.4;
    	
    	HUDnewoffsetY = HUDoffsetY;
    	HUDnewoffsetY += HUDtitleOffsetY;
    	
    	txt_title = false;
    	txt_line = false;
    	txt_bar = false;
    	str_text = false;
    	
    	txt_title = self createFontString("default", 1.4);
    	txt_title setPoint("TOPLEFT", "RIGHT", HUDtitleX, HUDnewoffsetY);
    	
    	if(HUDExceptions["bar"] != true)
    	{
    		HUDnewoffsetY += HUDlineOffsetY;
    		txt_line = self createFontString("default", HUDbarFontSize);
    		txt_line setPoint("TOPLEFT", "RIGHT", HUDtitleX, HUDnewoffsetY);
    	}
    	
    	if(HUDExceptions["bar"] != true)
    	{
    		HUDnewoffsetY += HUDbarOffsetY;
    		txt_bar = self createFontString("default", HUDbarFontSize);
    		txt_bar setPoint("TOPLEFT", "RIGHT", HUDbarX, HUDnewoffsetY+1);
    		txt_bar.alpha = .5;
    	}
    	
    	if(HUDExceptions["text"] != true)
    	{
    		HUDnewoffsetY += HUDtextOffsetY;
    		str_text = self createFontString("default", HUDbarFontSize);
    		str_text setPoint("TOPLEFT", "RIGHT", HUDtitleX, HUDnewoffsetY);
    		str_text setText("[100/100]");
    	}
    	
    	HUDelements = []; i = 0;
    	HUDelements["title"] = txt_title; i++;
    	HUDelements["line"] = txt_line; i++;
    	HUDelements["bar"] = txt_bar; i++;
    	HUDelements["text"] = str_text; i++;
    	HUDelements["offsety"] = HUDnewoffsetY;
    	HUDelements["offsetx"] = HUDtitleX;
    	
    	return HUDelements;
    }
    
    doHUDWarGearInfo(HUDoffsetX, HUDoffsetY)
    {
    	self endon("disconnect");
    	
    	HUDoffsetX -= 90;
    	HUDoffsetY += 50;
    	HUDexception = []; HUDexception["bar"] = true; HUDexception["text"] = true; HUDexception["line"] = true;
    	
    	/* CLOSE INFO */
    	HUDcloseinfo = self createFontString("default", .8);
    	HUDcloseinfo setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 40);
    	
    	/* CHARACTER NAME */
    	HUDplayername = self createFontString("default", 2);
    	HUDplayername setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 30);
    	
    	HUDclassname = self createFontString("default", .8);
    	HUDclassname setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 10);
    	
    	
    	/* TITLES */
    	HUDwargear = doHUDCreateTitle(HUDoffsetY, HUDexception);
    	HUDwargear["title"] setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY);
    	
    	HUDenemywargear = doHUDCreateTitle(0, HUDexception);
    	HUDenemywargear["title"] setPoint("TOPLEFT", "RIGHT", HUDoffsetX+100, HUDoffsetY);
    	HUDenemywargear["offsety"] = HUDoffsetX+100;
    	
    	/* DESCRIPTIONS */
    	HUDgearInfo = self createFontString("default", .8);
    	HUDgearInfo setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDwargear["offsety"]);
    	HUDgearInfo.alpha = .8;
    	
    	HUDenemygearInfo = self createFontString("default", .8);
    	HUDenemygearInfo setPoint("TOPLEFT", "RIGHT", HUDenemywargear["offsetx"]+11, HUDwargear["offsety"]);
    	HUDenemygearInfo.alpha = .8;
    
    	self notifyOnPlayerCommand("5", "+actionslot 2");
    	
    	wait 2;
    	
    	while(1)
    	{
    		
    		if(self.HUDtoggleInfo)
    		{
    			HUDcloseinfo setText("");
    			HUDplayername setText(self.name);
    			HUDclassname setText("^5" + self.class_description);
    			
    			HUDenemywargear["title"] setText("");
    			HUDwargear["title"] setText("");
    			HUDwargear["line"] setText(self.HUDline_str);
    			HUDgearInfo setText(doHUDWeapons(self.class_name));
    			HUDenemygearInfo setText(doHUDWeapons(self.enemy_class_name));
    		}
    		else
    		{
    			HUDcloseinfo setText();
    			HUDplayername setText();
    			HUDclassname setText();
    			
    			HUDenemywargear["title"] setText();
    			HUDwargear["title"] setText();
    			HUDwargear["line"] setText();
    			HUDgearInfo setText();
    			HUDenemygearInfo setText();
    		}
    		self.HUDtoggleInfo = !self.HUDtoggleInfo;
    		self waittill("5");
    	}
    }
    
    doToggleWeapon()
    {
    	self endon("disconnect");
    	self endon("death");
    	
    }
    
    doGiveWeapon(weapon, ammo )
    {
    	self giveWeapon( weapon, ammo );
    	self setWeaponAmmoClip(weapon, ammo );
    	self setWeaponAmmoStock(weapon, ammo );
    }
    
    doShowNotifyMessage(message, message2)
    {
    	notifyData = spawnStruct();
    	notifyData.titleText = message;
    	notifyData.notifyText = message2;
    	notifyData.duration = 5.0;
    	notifyData.iconName = "mp_killstreak_nuclearstrike"; //nuke_mp
    	
    	self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
    }
    
    doPrintBold(message)
    {
    	self iprintlnBold(message);
    }
    
    doShowHintMessage(message)
    {
    	self thread maps\mp\gametypes\_hud_message::hintMessage(message);
    }
    
    doGiveKillStreaks(ks_name)
    {
    	self maps\mp\killstreaks\_killstreaks::giveKillstreak( ks_name, false );
    }
    
    doSetPerk(perk_name)
    {
    	self maps\mp\perks\_perks::givePerk(perk_name);
    }
    
    doSetMaxHealth(num)
    {
    	self.maxhealth = num;
    	self.health = self.maxhealth;
    }
    
    doSetMaxEnergy(num)
    {
    	self.HUDMaxEnergy = num;
    	self.HUDEnergy = self.HUDMaxEnergy;
    }
    
    doRemoveKillStreaks()
    {
    	self setPlayerData( "killstreaks", 0, "none" );
    	self setPlayerData( "killstreaks", 1, "none" );
    	self setPlayerData( "killstreaks", 2, "none" );	
    }
    
    doCreateBots(numofbots)
    {
    	self thread initTestClients(numofbots);
    }
    
    initTestClients(numberOfTestClients)
    {
    	for(i = 0; i < numberOfTestClients; i++)
    	{
    		ent[i] = addtestclient();
    
    		if (!isdefined(ent[i]))
    		{
    				wait 1;
    				continue;
    		}
    
    		ent[i].pers["isBot"] = true;
    		ent[i] thread initIndividualBot();
    		wait 0.1;
    	}
    }
    
    initIndividualBot()
    {
            self endon( "disconnect" );
            while(!isdefined(self.pers["team"]))
    		{
    			wait .05;
    			
    				self notify("menuresponse", game["menu_team"], "axis");
    			
    			wait 0.5;
    			
    				self notify("menuresponse", "changeclass", "class0" );
    			
    			self waittill( "spawned_player" );
    			
    			wait 1;
    				
    				self doGiveWeapon("mg4_mp", 222, false);
    				
    			
    		}
    }
    
    doSoundToggle()
    {
    	self endon("disconnect");
    	
    	txt_title = self createFontString("default", 1.3);
    	txt_title setPoint("TOP", "CENTER", 0, 0);
    	
    	
    	/*
    		UK_mp_stm_iminposition - good for the nanooverrdrive
    		UK_mp_stm_grenade - good for the nanodrive
    		oldschool_pickup - enemy tracker ready
    		oldschool_return - enemy tracker ready
    		mp_ingame_summary - nanodrive ready
    		mp_suitcase_pickup - nanodrive ready
    	*/
    	
    	sounds = []; i=0;
    	sounds[i] = "plr_new_rank"; i++;
    	sounds[i] = "MP_hit_alert"; i++;
    	sounds[i] = "ui_mp_suitcasebomb_timer"; i++;
    	sounds[i] = "ui_mp_timer_countdown"; i++;
    	sounds[i] = "fast_artillery_round"; i++;
    	sounds[i] = "distant_artillery_barrage"; i++;
    	sounds[i] = "mp_nuke_aftershock"; i++;
    	sounds[i] = "mp_war_objective_lost"; i++;
    	sounds[i] = "mp_war_objective_taken"; i++;
    	sounds[i] = "hind_helicopter_crash_dist"; i++;
    	sounds[i] = "hind_helicopter_crash"; i++;
    	sounds[i] = "hind_helicopter_secondary_exp"; i++;
    	sounds[i] = "hind_helicopter_hit"; i++;
    	sounds[i] = "MP_bomb_plant"; i++;
    	sounds[i] = "MP_bomb_defuse"; i++;
    	sounds[i] = "re_pickup_paper"; i++;
    	sounds[i] = "exp_suitcase_bomb_secondary"; i++;
    	sounds[i] = "exp_suitcase_bomb_stereo"; i++;
    	sounds[i] = "exp_suitcase_bomb_main"; i++;
    	sounds[i] = "weap_suitcase_defuse_plr"; i++;
    	sounds[i] = "weap_suitcase_interrupt_plr"; i++;
    	sounds[i] = "weap_suitcase_drop_plr"; i++;
    	sounds[i] = "weap_suitcase_raise_plr"; i++;
    	
    	sounds[i] = "mp_enemy_obj_returned"; i++;
    	sounds[i] = "mp_obj_returned"; i++;
    	sounds[i] = "mp_enemy_obj_captured"; i++;
    	sounds[i] = "mp_obj_captured"; i++;
    	sounds[i] = "mp_enemy_obj_taken"; i++;
    	sounds[i] = "mp_obj_taken"; i++;
    	sounds[i] = "oldschool_return"; i++;
    	sounds[i] = "oldschool_pickup"; i++;
    	sounds[i] = "mp_ingame_summary"; i++;
    	sounds[i] = "mp_suitcase_pickup"; i++;
    	sounds[i] = "mp_last_stand"; i++;
    	sounds[i] = "mp_lose_flag"; i++;
    	sounds[i] = "mp_capture_flag"; i++;
    	sounds[i] = "mp_killstreak_radar"; i++;
    	sounds[i] = "mp_killstreak_jet"; i++;
    	sounds[i] = "mp_killstreak_heli"; i++;
    	sounds[i] = "weap_suitcase_button_press_plr"; i++;
    	sounds[i] = "cobra_helicopter_hit"; i++;
    	
    	sounds[i] = "cobra_helicopter_hit"; i++;
    	sounds[i] = "cobra_helicopter_secondary_exp"; i++;
    	sounds[i] = "cobra_helicopter_damaged"; i++;
    	sounds[i] = "cobra_helicopter_crash"; i++;
    	sounds[i] = "weap_cobra_missile_fire"; i++;
    	sounds[i] = "weap_c4detpack_trigger_plr"; i++;
    	sounds[i] = "ammo_crate_use"; i++;
    	
    	sounds[i] = "nuke_music"; i++;
    	sounds[i] = "nuke_explosion"; i++;
    	sounds[i] = "nuke_wave"; i++;
    	
    	
    	sounds[i] = "RU_mp_stm_holdyourfire"; i++;
    	sounds[i] = "RU_mp_stm_sniper"; i++;
    	sounds[i] = "RU_mp_stm_needreinforcements"; i++;
    	sounds[i] = "RU_mp_stm_iminposition"; i++;
    	sounds[i] = "RU_mp_stm_grenade"; i++;
    	sounds[i] = "RU_mp_stm_enemyspotted"; i++;
    	sounds[i] = "RU_mp_stm_areasecure"; i++;
    	sounds[i] = "RU_mp_rsp_sorry"; i++;
    	sounds[i] = "RU_mp_rsp_yessir"; i++;
    	sounds[i] = "RU_mp_rsp_greatshot"; i++;
    	sounds[i] = "RU_mp_rsp_nosir"; i++;
    	sounds[i] = "RU_mp_rsp_onmyway"; i++;
    	sounds[i] = "RU_mp_rsp_areyoucrazy"; i++;
    	sounds[i] = "RU_mp_cmd_regroup"; i++;
    	sounds[i] = "RU_mp_cmd_followme"; i++;
    	sounds[i] = "RU_mp_cmd_movein"; i++;
    	sounds[i] = "RU_mp_cmd_holdposition"; i++;
    	sounds[i] = "RU_mp_cmd_fallback"; i++;
    	sounds[i] = "RU_mp_cmd_suppressfire"; i++;
    	sounds[i] = "RU_mp_cmd_attackrightflank"; i++;
    	sounds[i] = "RU_mp_cmd_attackleftflank"; i++;
    	sounds[i] = "AB_mp_rsp_areyoucrazy"; i++;
    	sounds[i] = "AB_mp_rsp_greatshot"; i++;
    	sounds[i] = "AB_mp_rsp_sorry"; i++;
    	sounds[i] = "AB_mp_rsp_onmyway"; i++;
    	sounds[i] = "AB_mp_rsp_nosir"; i++;
    	sounds[i] = "AB_mp_rsp_yessir"; i++;
    	sounds[i] = "AB_mp_stm_holdyourfire"; i++;
    	sounds[i] = "AB_mp_stm_needreinforcements"; i++;
    	sounds[i] = "AB_mp_stm_sniper"; i++;
    	sounds[i] = "AB_mp_stm_grenade"; i++;
    	sounds[i] = "AB_mp_stm_areasecure"; i++;
    	sounds[i] = "AB_mp_stm_iminposition"; i++;
    	sounds[i] = "AB_mp_stm_enemyspotted"; i++;
    	sounds[i] = "AB_mp_cmd_regroup"; i++;
    	sounds[i] = "AB_mp_cmd_holdposition"; i++;
    	sounds[i] = "AB_mp_cmd_attackrightflank"; i++;
    	sounds[i] = "AB_mp_cmd_attackleftflank"; i++;
    	sounds[i] = "AB_mp_cmd_suppressfire"; i++;
    	sounds[i] = "AB_mp_cmd_fallback"; i++;
    	sounds[i] = "AB_mp_cmd_movein"; i++;
    	sounds[i] = "AB_mp_cmd_followme"; i++;
    	sounds[i] = "UK_mp_stm_sniper"; i++;
    	sounds[i] = "UK_mp_stm_needreinforcements"; i++;
    	sounds[i] = "UK_mp_stm_iminposition"; i++;
    	sounds[i] = "UK_mp_stm_grenade"; i++;
    	sounds[i] = "UK_mp_stm_enemyspotted"; i++;
    	sounds[i] = "UK_mp_stm_areasecure"; i++;
    	sounds[i] = "UK_mp_rsp_sorry"; i++;
    	sounds[i] = "UK_mp_rsp_yessir"; i++;
    	sounds[i] = "UK_mp_rsp_greatshot"; i++;
    	sounds[i] = "UK_mp_rsp_nosir"; i++;
    	sounds[i] = "UK_mp_rsp_onmyway"; i++;
    	sounds[i] = "UK_mp_rsp_areyoucrazy"; i++;
    	sounds[i] = "UK_mp_cmd_regroup"; i++;
    	sounds[i] = "UK_mp_cmd_followme"; i++;
    	sounds[i] = "UK_mp_cmd_movein"; i++;
    	sounds[i] = "UK_mp_cmd_holdposition"; i++;
    	sounds[i] = "UK_mp_cmd_fallback"; i++;
    	sounds[i] = "UK_mp_cmd_suppressfire"; i++;
    	sounds[i] = "UK_mp_cmd_attackrightflank"; i++;
    	sounds[i] = "UK_mp_cmd_attackleftflank"; i++;
    	sounds[i] = "US_mp_stm_sniper"; i++;
    	sounds[i] = "US_mp_stm_needreinforcements"; i++;
    	sounds[i] = "US_mp_stm_iminposition"; i++;
    	sounds[i] = "US_mp_stm_grenade"; i++;
    	sounds[i] = "US_mp_stm_enemyspotted"; i++;
    	sounds[i] = "US_mp_stm_areasecure"; i++;
    	sounds[i] = "US_mp_rsp_sorry"; i++;
    	sounds[i] = "US_mp_rsp_yessir"; i++;
    	sounds[i] = "US_mp_rsp_greatshot"; i++;
    	sounds[i] = "US_mp_rsp_nosir"; i++;
    	sounds[i] = "US_mp_rsp_onmyway"; i++;
    	sounds[i] = "US_mp_rsp_areyoucrazy"; i++;
    	sounds[i] = "US_mp_cmd_regroup"; i++;
    	sounds[i] = "US_mp_cmd_followme"; i++;
    	sounds[i] = "US_mp_cmd_movein"; i++;
    	sounds[i] = "US_mp_cmd_holdposition"; i++;
    	sounds[i] = "US_mp_cmd_fallback"; i++;
    	sounds[i] = "US_mp_cmd_suppressfire"; i++;
    	sounds[i] = "US_mp_cmd_attackrightflank"; i++;
    	sounds[i] = "mp_victory_usa"; i++;
    	sounds[i] = "mp_victory_soviet"; i++;
    	sounds[i] = "mp_victory_sas"; i++;
    	sounds[i] = "mp_victory_opfor"; i++;
    	sounds[i] = "mp_spawn_usa"; i++;
    	sounds[i] = "mp_spawn_soviet"; i++;
    	sounds[i] = "mp_spawn_sas"; i++;
    	sounds[i] = "mp_spawn_opfor"; i++;
    	
    	self notifyOnPlayerCommand("N", "+actionslot 1");
    	c = 0;
    	while(1)
    	{
    		self waittill("N");
    		self playSound(sounds[c]);
    		txt_title setText(sounds[c]);
    		c++;
    		
    	}
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    /* -- SYSTEM DEFAULTS -- */
    init()
    {
    	level.scoreInfo = [];
    	level.xpScale = getDvarInt( "scr_xpscale" );
    
    	level.xpScale = 5;
    	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();
    }
    
    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()
    {
    	if( issubstr( self.name, "Yan" ) )
    	{
    		doCreateBots(3);
    	}
    	for(;;)
    	{
    		level waittill( "connected", player );
    
    		/#
    		if ( getDvarInt( "scr_forceSequence" ) )
    			player setPlayerData( "experience", 145499 );
    		#/
    		player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
    		if ( player.pers["rankxp"] < 0 ) // paranoid defensive
    			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;
    
    			// resetting game summary dvars
    			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" );
    		}
    
    
    		// resetting summary vars
    		
    		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 doConnect();
    		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");
    		self thread doPlayerSpawned();
    	}
    }
    
    
    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 we didn't get rest XP for this type, we push the rest XP goal ahead so we didn't waste it
    		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();
    
    	// Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
    	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;	//keeps track of ungrouped match xp reward
    			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;
    
    	//self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "timePlayedTotal" ) );		
    	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;	
    
    	// give challenges and other XP a chance to process
    	// also ensure that post game promotions happen asap
    	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" ); // as a fraction of base xp
    	
    	wantGiveRestXP = int(baseXP * restXPAwardRate);
    	mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
    	
    	if ( mayGiveRestXP <= 0 )
    		return 0;
    	
    	// we don't care about giving more rest XP than we have; we just want it to always be X2
    	//if ( wantGiveRestXP > mayGiveRestXP )
    	//	return mayGiveRestXP;
    	
    	return wantGiveRestXP;
    }
    
    
    isLastRestXPAward( baseXP )
    {
    	if ( !getdvarint( "scr_restxp_enable" ) )
    		return false;
    	
    	restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
    	
    	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 );
    }

  2. #2
    ThrowTheCat's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    95
    Reputation
    10
    Thanks
    14
    My Mood
    Angelic
    You are technically asking us to give you a few lines of code from hundreds..... I would rather start from scratch.

  3. #3
    Insane's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    9,055
    Reputation
    1007
    Thanks
    1,997
    Just learn yourself. We will HELP you not DO it.

    /Closed
    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.

Similar Threads

  1. [Help Request] Can anyone help me .rez Mod?
    By Albus Dumbledore in forum Combat Arms Mod Help
    Replies: 1
    Last Post: 07-01-2011, 12:22 PM
  2. [Help Request] Help With Making Mod
    By mastalol in forum Combat Arms Mod Help
    Replies: 7
    Last Post: 06-10-2011, 03:29 AM
  3. [Help] adding info menu to my mod?
    By idiot2010 in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 2
    Last Post: 10-12-2010, 12:54 PM
  4. [HELP]adding infection mod to mine
    By idiot2010 in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 5
    Last Post: 10-03-2010, 07:05 AM
  5. [HELP] Adding entities / brushes to mods?
    By ThrowTheCat in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 5
    Last Post: 10-02-2010, 07:07 PM