#include extreme\_ex_weapons;
#include extreme\_ex_statshud;

main(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc)
{
	self endon("disconnect");

	level.obitlog = 0;

	// do not report command monitor deaths
	if(level.ex_cmdmonitor && isDefined(self.ex_cmdmondeath))
	{
		self.ex_cmdmondeath = undefined;
		return;
	}

	// do not report forced suicides
	if(isDefined(self.ex_forcedsuicide) && self.ex_forcedsuicide)
	{
		self.ex_forcedsuicide = undefined;
		return;
	}

	// do not report forced suicide for camping
	if(isDefined(self.ex_iscamper) && self.ex_iscamper) return;
	
	// do not report forced suicide for team switch
	if(isDefined(self.switching_teams) && self.switching_teams) return;

	self.ex_obmonamsg = false;
	self.ex_obmonpmsg = false;
	self.ex_obmonpsound = false;

	// 0 = no obituary       - with stats (---)
	// 1 = stock obituary    - with stats (---)
	// 2 = stock obituary    - with stats and personal sounds (--S)
	// 3 = stock obituary    - with stats and personal messages (-M-)
	// 4 = stock obituary    - with stats, personal messages and personal sounds (-MS)
	// 5 = eXtreme+ obituary - with stats (X--)
	// 6 = eXtreme+ obituary - with stats and personal sounds (X-S)
	// 7 = eXtreme+ obituary - with stats and personal message (XM-)
	// 8 = eXtreme+ obituary - with stats, personal messages and personal sounds (XMS)
	if(level.ex_obituary >= 5) self.ex_obmonamsg = true;
	if(level.ex_obituary == 3 || level.ex_obituary == 4 || level.ex_obituary == 7 || level.ex_obituary == 8) self.ex_obmonpmsg = true;
	if(level.ex_obituary == 2 || level.ex_obituary == 4 || level.ex_obituary == 6 || level.ex_obituary == 8) self.ex_obmonpsound = true;

	if(level.ex_obituary >= 1 && level.ex_obituary <= 4) obituary(self, attacker, sWeapon, sMeansOfDeath);
	thread extremeobituary(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc);
}

extremeobituary(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc)
{
	self endon("disconnect");

	// sMeansOfDeath conversions
	if(sMeansOfDeath == "MOD_EXPLOSIVE")
	{
		switch(sWeapon)
		{
			case "artillery_mp": sMeansOfDeath = "MOD_ARTILLERY"; break;
			case "tripwire_mp": sMeansOfDeath = "MOD_TRIPWIRE"; break;
			case "landmine_mp": sMeansOfDeath = "MOD_LANDMINE"; break;
			case "smoke_grenade_american_fire_mp": sMeansOfDeath = "MOD_FIRENADE"; break;
			case "smoke_grenade_british_fire_mp": sMeansOfDeath = "MOD_FIRENADE"; break;
			case "smoke_grenade_german_fire_mp": sMeansOfDeath = "MOD_FIRENADE"; break;
			case "smoke_grenade_russian_fire_mp": sMeansOfDeath = "MOD_FIRENADE"; break;
			case "fire_mp": sMeansOfDeath = "MOD_FIRENADE"; break;
		}
	}
	else if(sMeansOfDeath == "MOD_GRENADE")
	{
		switch(sWeapon)
		{
			case "mortar_mp": sMeansOfDeath = "MOD_MORTAR"; break;
			case "planebomb_mp": sMeansOfDeath = "MOD_AIRSTRIKE"; break;
			//case "knife_mp": sMeansOfDeath = "MOD_KNIFE"; break; // old knife_mp
		}
	}
	else if(sMeansOfDeath == "MOD_PROJECTILE")
	{
		switch(sWeapon)
		{
			case "planebomb_mp": sMeansOfDeath = "MOD_NAPALM"; break;
			case "panzerschreck_mp": sMeansOfDeath = "MOD_PANZER"; break;
			case "panzerschreck_allies": sMeansOfDeath = "MOD_BAZOOKA"; break;
			case "flamethrower_allies": sMeansOfDeath = "MOD_FLAMETHROWER"; break;
			case "flamethrower_axis": sMeansOfDeath = "MOD_FLAMMENWERFER"; break;
		}
	}
	else if(sMeansOfDeath == "MOD_GRENADE_SPLASH")
	{
		switch(sWeapon)
		{
			case "smoke_grenade_american_gas_mp": sMeansOfDeath = "MOD_GASNADE"; break;
			case "smoke_grenade_british_gas_mp": sMeansOfDeath = "MOD_GASNADE"; break;
			case "smoke_grenade_german_gas_mp": sMeansOfDeath = "MOD_GASNADE"; break;
			case "smoke_grenade_russian_gas_mp": sMeansOfDeath = "MOD_GASNADE"; break;
			case "gas_mp": sMeansOfDeath = "MOD_GASNADE"; break;
			case "smoke_grenade_american_satchel_mp": sMeansOfDeath = "MOD_SATCHELCHARGE"; break;
			case "smoke_grenade_british_satchel_mp": sMeansOfDeath = "MOD_SATCHELCHARGE"; break;
			case "smoke_grenade_german_satchel_mp": sMeansOfDeath = "MOD_SATCHELCHARGE"; break;
			case "smoke_grenade_russian_satchel_mp": sMeansOfDeath = "MOD_SATCHELCHARGE"; break;
			case "satchel_mp": sMeansOfDeath = "MOD_SATCHELCHARGE"; break;
		}
	}
	else if(sMeansOfDeath == "MOD_PROJECTILE_SPLASH")
	{
		switch(sWeapon)
		{
			case "panzerschreck_mp": sMeansOfDeath = "MOD_PANZER"; break;
			case "panzerschreck_allies": sMeansOfDeath = "MOD_BAZOOKA"; break;
		}
	}
	else if(sMeansOfDeath == "MOD_HEAD_SHOT")
	{
		if(sWeapon == "knife_mp") sMeansOfDeath = "MOD_KNIFE";
	}
	else if(sMeansOfDeath == "MOD_PISTOL_BULLET")
	{
		if(sWeapon == "knife_mp") sMeansOfDeath = "MOD_KNIFE"; // new knife_mp
	}

	if(level.obitlog) logprint("OBITUARY LOG: " + sMeansOfDeath + ", Weapon: " + sWeapon + ", Hitloc: " + sHitLoc + "\n");

	if(sMeansOfDeath == "MOD_TRIGGER_HURT") // unknown death
	{
		obitnad("", "unknown", false);
	}
	else if(sMeansOfDeath == "MOD_FALLING")	// falling
	{
		obitnad("fallingdeath", "falling", true);
	}
	else if(isDefined(attacker) && !isPlayer(attacker)) // ambient fx deaths
	{
		switch(sMeansOfDeath)
		{
			case "MOD_EXPLOSIVE":
			{
				switch(sWeapon)
				{
					case "mortar_mp":
					obitnad("mortardeath", "mortar", false);
					break;
					
					case "plane_mp":
					obitnad("planedeath", "plane", false);
					break;
					
					case "planebomb_mp":
					obitnad("airstrikedeath", "plane_bomb", false);
					break;

					case "panzerschreck_mp":
					obitnad("panzerdeath", "panzer", false);
					break;

					case "panzerschreck_allies":
					obitnad("panzerdeath", "bazooka", false);
					break;

					default:
					obitnad("minefielddeath", "minefield", true);
					break;
				}
			}
		}
	}
	else if(isDefined(attacker) && isPlayer(attacker)) // real player kills/deaths
	{
		if(attacker == self) // killed themself
		{
			switch(sMeansOfDeath)
			{
				case "MOD_GRENADE_SPLASH":
				if(isWeaponType(sWeapon, "grenade")) obitnad("grenadedeath", "selfnade", false);
				break;

				case "MOD_ARTILLERY":
				obitnad("artillerydeath", "selfartillery", false);
				break;

				case "MOD_FIRENADE":
				obitnad("firenadedeath", "selffirenade", false);
				break;

				case "MOD_GASNADE":
				obitnad("gasnadedeath", "selfgasnade", false);
				break;
				
				case "MOD_SATCHELCHARGE":
				obitnad("satchelchargedeath", "selfsatchelcharge", false);
				break;

				case "MOD_MORTAR":
				obitnad("mortardeath", "selfmortar", false);
				break;

				case "MOD_AIRSTRIKE":
				obitnad("airstrikedeath", "selfairstrike", false);
				break;

				case "MOD_NAPALM":
				obitnad("napalmdeath", "selfnapalm", false);
				break;

				case "MOD_PANZER":
				obitnad("panzerdeath", "selfpanzer", false);
				break;

				case "MOD_BAZOOKA":
				obitnad("panzerdeath", "selfbazooka", false);
				break;

				case "MOD_TRIPWIRE":
				obitnad("tripwiredeath", "selftripwire", false);
				break;

				case "MOD_LANDMINE":
				obitnad("landminedeath", "selflandmine", false);
				break;

				case "MOD_FLAMETHROWER":
				obitnad("flamethrowerdeath", "selfflamethrower", false);
				break;

				case "MOD_FLAMMENWERFER":
				obitnad("flamethrowerdeath", "selfflammenwerfer", false);
				break;

				case "MOD_SUICIDE":
				obitnad("grenadedeath", "selfnades", true);
				break;
				
				case "MOD_KNIFE":
				obitnad("knifedeath", "selfknife", false);
				break;
			}
		}
		else if(attacker.pers["team"] != self.pers["team"] && level.ex_teamplay || !level.ex_teamplay) // did not kill themself
		{
			if(isMeansOfDeath(sMeansOfDeath)) // special sMOD
			{
				switch(sMeansOfDeath)
				{
					case "MOD_MELEE":
					{
						if(sWeapon == "knife_mp") // register knife bash as normal kill
						{
							obitad(attacker, "knifekill", "knifedeath", "knifewhip", sMeansOfDeath, sWeapon);
							break;
						}
						else
						{
							if(sHitLoc == "head")	obitad(attacker, "bashkill", "bashdeath", "bashkill_head", sMeansOfDeath, sWeapon);
								else obitad(attacker, "bashkill", "bashdeath", "bashkill", sMeansOfDeath, sWeapon);
							if(self.ex_obmonpmsg) self iprintlnbold(&"OBITUARY_HUMILIATION");
							if(self.ex_obmonpsound) self playLocalSound("humiliation");
							break;
						}
					}

					case "MOD_GRENADE_SPLASH":
					{
						if(isWeaponType(sWeapon, "grenade"))
						{
							obitspec(attacker, "grenadekill", "grenadedeath", "explosive", &"OBITUARY_WITH_A_GRENADE");
							break;
						}
					}

					case "MOD_KNIFE":
					obitspec(attacker, "knifekill", "knifedeath", "pknife", &"OBITUARY_WITH_KNIFE");
					break;
					
					case "MOD_ARTILLERY":
					obitspec(attacker, "artillerykill", "artillerydeath", "explosive", &"OBITUARY_WITH_ARTILLERY");
					break;

					case "MOD_FIRENADE":
					obitspec(attacker, "firenadekill", "firenadedeath", "pfirenade", &"OBITUARY_WITH_FIRENADE");
					break;

					case "MOD_GASNADE":
					obitspec(attacker, "gasnadekill", "gasnadedeath", "pgasnade", &"OBITUARY_WITH_GASNADE");
					break;
					
					case "MOD_SATCHELCHARGE":
					obitspec(attacker, "satchelchargekill", "satchelchargedeath", "psatchelcharge", &"OBITUARY_WITH_SATCHELCHARGE");
					break;

					case "MOD_MORTAR":
					obitspec(attacker, "mortarkill", "mortardeath", "explosive", &"OBITUARY_WITH_MORTAR");
					break;

					case "MOD_AIRSTRIKE":
					obitspec(attacker, "airstrikekill", "airstrikedeath", "explosive", &"OBITUARY_WITH_AIRSTRIKE");
					break;

					case "MOD_NAPALM":
					obitspec(attacker, "napalmkill", "napalmdeath", "pnapalm", &"OBITUARY_WITH_NAPALM");
					break;

					case "MOD_PANZER":
					obitspec(attacker, "panzerkill", "panzerdeath", "ppanzer", &"OBITUARY_WITH_PANZER");
					break;

					case "MOD_BAZOOKA":
					obitspec(attacker, "panzerkill", "panzerdeath", "pbazooka", &"OBITUARY_WITH_BAZOOKA");
					break;

					case "MOD_TRIPWIRE":
					obitspec(attacker, "tripwirekill", "tripwiredeath", "explosive", &"OBITUARY_WITH_TRIPWIRE");
					break;

					case "MOD_LANDMINE":
					obitspec(attacker, "landminekill", "landminedeath", "explosive", &"OBITUARY_WITH_LANDMINE");
					break;

					case "MOD_FLAMETHROWER":
					obitspec(attacker, "flamethrowerkill", "flamethrowerdeath", "pflamethrower", &"OBITUARY_WITH_FLAMETHROWER");
					break;

					case "MOD_FLAMMENWERFER":
					obitspec(attacker, "flamethrowerkill", "flamethrowerdeath", "pflammenwerfer", &"OBITUARY_WITH_FLAMMENWERFER");
					break;

					case "MOD_HEAD_SHOT":
					{
						obitad(attacker, "headshotkill", "headshotdeath", "", sMeansOfDeath, sWeapon);
						if(isWeaponType(sWeapon, "sniper")) obitstat(attacker, "sniperkill", "sniperdeath");
						obitmain(attacker, sWeapon, sHitLoc, false);
						if(self.ex_obmonpmsg) attacker iprintlnbold(&"OBITUARY_HEADSHOT");
						if(self.ex_obmonpsound) attacker playLocalSound("headshot");
						break;
					}
				}
			}
			else // not special sMOD
			{
				// sniper kills
				if(isWeaponType(sWeapon, "sniper"))
				{
					obitad(attacker, "sniperkill", "sniperdeath", "", sMeansOfDeath, sWeapon);
					obitmain(attacker, sWeapon, sHitLoc, false);
					sMeansOfDeath = "MOD_IGNORE";
				}
			}
		}
		else if(attacker.pers["team"] == self.pers["team"] && level.ex_teamplay) // team kills
		{
			if(isMeansOfDeath(sMeansOfDeath)) // special sMOD
			{
				switch(sMeansOfDeath)
				{
					case "MOD_MELEE":
					{
						if(sWeapon == "knife_mp")
						{
							obitteam(attacker, "knifewhiptk", sMeansOfDeath, sWeapon);
							break;
						}
						else
						{
							obitteam(attacker, "bashtk", sMeansOfDeath, sWeapon);
							break;
						}
					}

					case "MOD_KNIFE":
					obitteam(attacker, "knifetk", sMeansOfDeath, sWeapon);
					break;
					
					case "MOD_GRENADE_SPLASH":
					obitteam(attacker, "explosivetk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_ARTILLERY":
					obitteam(attacker, "explosivetk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_FIRENADE":
					obitteam(attacker, "firenadetk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_GASNADE":
					obitteam(attacker, "gasnadetk", sMeansOfDeath, sWeapon);
					break;
					
					case "MOD_SATCHELCHARGE":
					obitteam(attacker, "satchelchargetk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_MORTAR":
					obitteam(attacker, "explosivetk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_AIRSTRIKE":
					obitteam(attacker, "explosivetk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_NAPALM":
					obitteam(attacker, "napalmtk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_PANZER":
					obitteam(attacker, "panzertk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_BAZOOKA":
					obitteam(attacker, "bazookatk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_TRIPWIRE":
					obitteam(attacker, "explosivetk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_LANDMINE":
					obitteam(attacker, "explosivetk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_FLAMETHROWER":
					obitteam(attacker, "flamethrowertk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_FLAMMENWERFER":
					obitteam(attacker, "flammenwerfertk", sMeansOfDeath, sWeapon);
					break;

					case "MOD_HEAD_SHOT":
					obitteam(attacker, "headshottk", sMeansOfDeath, sWeapon);
					break;
				}
			}
			else // not special sMOD
			{
				if(isWeaponType(sWeapon, "sniper"))
				{
					obitteam(attacker, "snipertk", sMeansOfDeath, sWeapon);
					sMeansOfDeath = "MOD_IGNORE";
				}
			}
		}
	}

	// standard deaths
	if(sHitLoc != "none" && !isWeapon(sWeapon) && !isMeansOfDeath(sMeansOfDeath) && isPlayer(attacker))
	{
		if(attacker.pers["team"] != self.pers["team"] && level.ex_teamplay || !level.ex_teamplay) obitmain(attacker, sWeapon, sHitLoc, true);
			else if(attacker.pers["team"] == self.pers["team"] && attacker != self && level.ex_teamplay) obitteam(attacker, "teamkill", sMeansOfDeath, sWeapon);
	}
	
	self thread killspree(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc);
	if(!isWeaponType(sWeapon, "smg")) self thread weaponstreak(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc);
	if(isWeaponType(sWeapon, "smg") || isWeaponType(sWeapon, "mg")) self thread noobstreak(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc);
	self thread consecdeath(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc);
	if(level.ex_statshud)
	{
		//self thread showStatsHUD();
		if(isDefined(attacker) && isPlayer(attacker)) attacker thread showStatsHUD();
	}
}

isWeapon(sWeapon)
{
	switch(sWeapon)
	{
		case "mortar_mp":
		case "plane_mp":
		case "planebomb_mp":
		case "tripwire_mp":
		case "landmine_mp":
		case "knife_mp":
		case "panzerschreck_mp":
		case "panzerschreck_allies":		
		case "smoke_grenade_american_fire_mp":
		case "smoke_grenade_british_fire_mp":
		case "smoke_grenade_german_fire_mp":
		case "smoke_grenade_russian_fire_mp":
		case "fire_mp":
		case "smoke_grenade_american_gas_mp":
		case "smoke_grenade_british_gas_mp":
		case "smoke_grenade_german_gas_mp":
		case "smoke_grenade_russian_gas_mp":
		case "gas_mp":
		case "flamethrower_allies":
		case "flamethrower_axis":
		case "smoke_grenade_american_satchel_mp":
		case "smoke_grenade_british_satchel_mp":
		case "smoke_grenade_german_satchel_mp":
		case "smoke_grenade_russian_satchel_mp":
		case "satchel_mp":
		return true;
	}

	return false;
}

isMeansOfDeath(sMeansOfDeath)
{
	switch(sMeansOfDeath)
	{
		case "MOD_FALLING":
		case "MOD_MELEE":
		case "MOD_KNIFE":
		case "MOD_GRENADE":
		case "MOD_GRENADE_SPLASH":
		case "MOD_EXPLOSIVE":
		case "MOD_SUICIDE":
		case "MOD_IGNORE":
		case "MOD_ARTILLERY":
		case "MOD_MORTAR":
		case "MOD_AIRSTRIKE":
		case "MOD_NAPALM":
		case "MOD_TRIPWIRE":
		case "MOD_LANDMINE":
		case "MOD_HEAD_SHOT":
		case "MOD_PROJECTILE":
		case "MOD_PANZER":		
		case "MOD_BAZOOKA":
		case "MOD_FIRENADE":
		case "MOD_GASNADE":
		case "MOD_FLAMETHROWER":
		case "MOD_FLAMMENWERFER":
		case "MOD_SATCHELCHARGE":
		return true;
	}

	return false;
}

// special detection - no attacker defined
obitnad(vartype, amsg, issuicide)
{
	self endon("disconnect");

	self.pers["death"]++;
	if(vartype != "") self.pers[vartype]++;
	if(issuicide)
	{
		self.pers["kill"]--;
		self.pers["suicide"]++;
	}

	if(level.obitlog) logprint("OBITNAD: self skd(" + self.score + ":" + self.pers["kill"] + ":" + self.pers["death"] + ")\n");

	if(amsg != "")
	{
		if(self.ex_obmonpmsg) self showpmsgs(amsg);
		if(self.ex_obmonamsg)
		{
			if(level.IsLinuxServer) iprintln(getmessage(amsg), self.name);
				else iprintln(getmessage(amsg), self);
		}
	}
}

// special detection - attacker defined
obitad(attacker, atvt, vivt, amsg, sMeansOfDeath, sWeapon)
{
	self endon("disconnect");

	attacker.pers["kill"]++;
	self.pers["death"]++;
	if(atvt != "") attacker.pers[atvt]++;
	if(vivt != "") self.pers[vivt]++;

	if(level.obitlog) logprint("OBITAD: attacker " + attacker.name + " skd(" + (attacker.score+1) + ":" + attacker.pers["kill"] + ":" + attacker.pers["death"] + "), self " + self.name + " skd(" + self.score + ":" + self.pers["kill"] + ":" + self.pers["death"] + ")\n");

	if(amsg != "")
	{
		weapon = getweaponstringname(sWeapon);
		
		if(sMeansOfDeath == "MOD_MELEE")
		{
			if(isWeaponType(sWeapon, "pistol"))
			{
				if(self.ex_obmonpmsg) self showpmsgs("pistolwhip");
				if(self.ex_obmonamsg)
				{
					if(level.IsLinuxServer)
					{
						iprintln(getmessage("pistolwhip"), self.name);
						iprintln(&"OBITUARY_USING", attacker.name, weapon);
					}
					else
					{
						iprintln(getmessage("pistolwhip"), self);
						iprintln(&"OBITUARY_USING", attacker, weapon);
					}
				}
			}
			else if(isWeaponType(sWeapon, "knife"))
			{
				if(self.ex_obmonpmsg) self showpmsgs("knifewhip");
				if(self.ex_obmonamsg)
				{
					if(level.IsLinuxServer)
					{
						iprintln(getmessage("knifewhip"), self.name);
						iprintln(&"OBITUARY_USING", attacker.name, weapon);
					}
					else
					{
						iprintln(getmessage("knifewhip"), self);
						iprintln(&"OBITUARY_USING", attacker, weapon);
					}
				}
			}
			else
			{
				if(self.ex_obmonpmsg) self showpmsgs(amsg);
				if(self.ex_obmonamsg)
				{
					if(level.IsLinuxServer)
					{
						iprintln(getmessage(amsg), self.name);
						iprintln(&"OBITUARY_USING_BUTT", attacker.name, weapon);
					}
					else
					{
						iprintln(getmessage(amsg), self);
						iprintln(&"OBITUARY_USING_BUTT", attacker, weapon);
					}
				}
			}
		}
		else
		{
			if(self.ex_obmonpmsg) self showpmsgs(amsg);
			if(self.ex_obmonamsg)
			{
				if(level.IsLinuxServer)
				{
					iprintln(getmessage(amsg), self.name);
					iprintln(&"OBITUARY_USING", attacker.name, weapon);
				}
				else
				{
					iprintln(getmessage(amsg), self);
					iprintln(&"OBITUARY_USING", attacker, weapon);
				}
			}
		}
	}
}

// killed by teammate
obitteam(attacker, amsg, sMeansOfDeath, sWeapon)
{
	self endon("disconnect");

	if(!level.ex_sinbin) attacker.pers["teamkill"]++; // If enabled, sinbin in _ex_main::exPlayerKilled will handle it
	attacker.pers["kill"]--;

	if(level.obitlog) logprint("OBITTEAM: attacker " + attacker.name + " skd(" + (attacker.score-1) + ":" + attacker.pers["kill"] + ":" + attacker.pers["death"] + "), self " + self.name + " skd(" + self.score + ":" + self.pers["kill"] + ":" + self.pers["death"] + ")\n");

	if(amsg != "")
	{
		weapon = getweaponstringname(sWeapon);
	
		if(sMeansOfDeath == "MOD_MELEE")
		{
			if(isWeaponType(sWeapon, "pistol"))
			{
				if(self.ex_obmonpmsg) self showpmsgs("pistolwhiptk");
				if(self.ex_obmonamsg)
				{
					if(level.IsLinuxServer)
					{
						iprintln(getmessage("pistolwhiptk"), self.name);
						iprintln(&"OBITUARY_USING", attacker.name, weapon);
					}
					else
					{
						iprintln(getmessage("pistolwhiptk"), self);
						iprintln(&"OBITUARY_USING", attacker, weapon);
					}
				}
			}
			else if(isWeaponType(sWeapon, "knife"))
			{
				if(self.ex_obmonpmsg) self showpmsgs("knifewhiptk");
				if(self.ex_obmonamsg)
				{
					if(level.IsLinuxServer)
					{
						iprintln(getmessage("knifewhiptk"), self.name);
						iprintln(&"OBITUARY_USING", attacker.name, weapon);
					}
					else
					{
						iprintln(getmessage("knifewhiptk"), self);
						iprintln(&"OBITUARY_USING", attacker, weapon);
					}
				}
			}
			else
			{
				if(self.ex_obmonpmsg) self showpmsgs(amsg);
				if(self.ex_obmonamsg)
				{
					if(level.IsLinuxServer)
					{
						iprintln(getmessage(amsg), self.name);
						iprintln(&"OBITUARY_USING_BUTT", attacker.name, weapon);
					}
					else
					{
						iprintln(getmessage(amsg), self);
						iprintln(&"OBITUARY_USING_BUTT", attacker, weapon);
					}
				}
			}
		}
		else
		{
			if(self.ex_obmonpmsg) self showpmsgs(amsg);
			if(self.ex_obmonamsg)
			{
				if(level.IsLinuxServer)
				{
					iprintln(getmessage(amsg), self.name);
					iprintln(&"OBITUARY_USING", attacker.name, weapon);
				}
				else
				{
					iprintln(getmessage(amsg), self);
					iprintln(&"OBITUARY_USING", attacker, weapon);
				}
			}
		}
	}
}

// handles weapon_gramatic of mass destruction deaths
obitspec(attacker, atvt, vivt, amsg, wmd)
{
	self endon("disconnect");

	attacker.pers["kill"]++;
	self.pers["death"]++;
	if(atvt != "") attacker.pers[atvt]++;
	if(vivt != "") self.pers[vivt]++;

	if(level.obitlog) logprint("OBITSPEC: attacker " + attacker.name + " skd(" + (attacker.score+1) + ":" + attacker.pers["kill"] + ":" + attacker.pers["death"] + "), self " + self.name + " skd(" + self.score + ":" + self.pers["kill"] + ":" + self.pers["death"] + ")\n");

	if(amsg != "")
	{
		if(self.ex_obmonpmsg) self showpmsgs(amsg);
		if(self.ex_obmonamsg)
		{
			if(level.IsLinuxServer)
			{
				iprintln(getmessage(amsg), self.name);
				iprintln(wmd, attacker.name);
			}
			else
			{
				iprintln(getmessage(amsg), self);
				iprintln(wmd, attacker);
			}
		}
	}
}

// standard weapons
obitmain(attacker, sWeapon, sHitLoc, updstat)
{
	self endon("disconnect");

	if(updstat)
	{
		attacker.pers["kill"]++;
		self.pers["death"]++;
	}

	if(level.obitlog) logprint("OBITMAIN: attacker " + attacker.name + " skd(" + (attacker.score+1) + ":" + attacker.pers["kill"] + ":" + attacker.pers["death"] + "), self " + self.name + " skd(" + self.score + ":" + self.pers["kill"] + ":" + self.pers["death"] + ")\n");

	if(!self.ex_obmonamsg) return;

	inyards = false;
	calcdist = undefined;
	showdist = false;

	range = int(distance(attacker.origin, self.origin));
	if(isDefined(range))
	{
		if(level.ex_obrange == 1)
		{
			inyards = true;
			calcdist = int(range * 0.02778); // Range in Yards
			if(calcdist > 9) showdist = true;
		}
		else
		{
			calcdist = int(range * 0.0254); // Range in Metres
			if(calcdist > 3) showdist = true;
		}

		attacker thread obitlongstat("longdist", calcdist);
		if(sHitloc == "head") attacker thread obitlongstat("longhead", calcdist);
	}

	weapon = getweaponstringname(sWeapon);
	hitloc = gethitlocstringname(sHitLoc);

	if(level.IsLinuxServer)
	{
		if(sWeapon == "knife_mp")
			iprintln(&"OBITUARY_KILLED_KNIFE", self.name);
		else
			iprintln(&"OBITUARY_KILLED_HITLOC", self.name, hitloc);

		if(showdist)
		{
			iprintln(&"OBITUARY_ATTACKER_WEAPON", attacker.name, weapon);
			if(inyards) iprintln(&"OBITUARY_YARDS", calcdist);
				else iprintln(&"OBITUARY_METRES", calcdist);
		}
		else
		{
			iprintln(&"OBITUARY_CLOSE_RANGE", attacker.name);
			iprintln(&"OBITUARY_USING_WEAPON", weapon);
		}
	}
	else
	{
		if(sWeapon == "knife_mp")
			iprintln(&"OBITUARY_KILLED_KNIFE", self);
		else
			iprintln(&"OBITUARY_KILLED_HITLOC", self, hitloc);

		if(showdist)
		{
			iprintln(&"OBITUARY_ATTACKER_WEAPON", attacker, weapon);
			if(inyards) iprintln(&"OBITUARY_YARDS", calcdist);
				else iprintln(&"OBITUARY_METRES", calcdist);
		}
		else
		{
			iprintln(&"OBITUARY_CLOSE_RANGE", attacker);
			iprintln(&"OBITUARY_USING_WEAPON", weapon);
		}
	}
}

// special stat update
obitstat(attacker, atvt, vivt)
{
	self endon("disconnect");

	if(atvt != "") attacker.pers[atvt]++;
	if(vivt != "") self.pers[vivt]++;
}

obitlongstat(stat, value)
{
	if(value > self.pers[stat])
	  self.pers[stat] = value;
}

killspree(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc)
{
	self endon("disconnect");

	if(!isPlayer(attacker)) return;
	if(level.ex_teamplay && attacker.pers["team"] == self.pers["team"])
	{
		attacker.pers["conseckill"]--;
		return;
	}

	if(attacker != self)
	{
		// check for end of a players killing spree	
		if(self.pers["conseckill"] >= 5)
		{
			if(self.ex_obmonamsg)
			{
				amsg1 = undefined;
				amsg2 = undefined;

				if(self.pers["conseckill"] >= 30)
				{
					amsg1 = &"KILLSPREE_HAS_SAVED_ALL_OUR_ASSES_FROM";
					amsg2 = &"KILLSPREE_ANAL_RAPE";
				}
				else if(self.pers["conseckill"] >= 25)
				{
					amsg1 = &"KILLSPREE_HAS_SAVED_US_ALL_FROM";
					amsg2 = &"KILLSPREE_UNHOLY";
				}
				else if(self.pers["conseckill"] >= 20)
				{
					amsg1 = &"KILLSPREE_HAS_STOPPED_THE_UNSTOPPABLE";
					amsg2 = &"KILLSPREE_CRUSADE";
				}
				else if(self.pers["conseckill"] >= 15)
				{
					amsg1 = &"KILLSPREE_HAS_STOPPED_THE_UNSTOPPABLE";
					amsg2 = &"KILLSPREE_UNREAL";
				}
				else if(self.pers["conseckill"] >= 10)
				{
					amsg1 = &"KILLSPREE_HAS_STOPPED";
					amsg2 = &"KILLSPREE_FLUKISH";
				}
				else if(self.pers["conseckill"] >= 5)
				{
					amsg1 = &"KILLSPREE_HAS_STOPPED";
					amsg2 = &"KILLSPREE_PLURAL";
				}

				if(isDefined(amsg1))
				{
					if(level.IsLinuxServer) iprintln(amsg1, attacker.name);
						else iprintln(amsg1, attacker);
				}
				if(isDefined(amsg2))
				{
					if(level.IsLinuxServer) iprintln(amsg2, self.name);
						else iprintln(amsg2, self);
				}
			}

			self.pers["conseckill"] = 0;

			if(self.ex_obmonpsound)
			{
				attacker playLocalSound("nailedhim");

				players = getentarray("player", "classname");
				for(i = 0; i < players.size; i++) if(players[i] != self) players[i] playlocalsound("hallelujah");
			}
		}

		// check for a players killing spree
		if(attacker.pers["conseckill"] < 0) attacker.pers["conseckill"] = 0;

		attacker.pers["conseckill"]++;
		attacker thread obitlongstat("longspree", attacker.pers["conseckill"]);

		pmsg = undefined;
		amsg = undefined;
		psnd = undefined;

		if(attacker.pers["conseckill"] >= 5)
		{
			if(attacker.pers["conseckill"] == 5)
			{
				amsg = &"KILLSPREE_MSG_5";
				pmsg = &"KILLSPREE_KILLSPREE_PMSG";
				psnd = "killingspree";
			}
			else if(attacker.pers["conseckill"] == 10)
			{
				amsg = &"KILLSPREE_MSG_10";
				pmsg = &"KILLSPREE_DOMINATING_PMSG";
				psnd = "dominating";
			}
			else if(attacker.pers["conseckill"] == 15)
			{
				amsg = &"KILLSPREE_MSG_15";
				pmsg = &"KILLSPREE_RAMPAGE_PMSG";
				psnd = "rampage";
			}
			else if(attacker.pers["conseckill"] == 20)
			{
				amsg = &"KILLSPREE_MSG_20";
				pmsg = &"KILLSPREE_UNSTOPPABLE_PMSG";
				psnd = "unstoppable";
			}
			else if(attacker.pers["conseckill"] == 25)
			{
				amsg = &"KILLSPREE_MSG_25";
				pmsg = &"KILLSPREE_MONSTER_KILL_PMSG";
				psnd = "monsterkill";
			}
			else if(attacker.pers["conseckill"] >= 30)
			{
				amsg = &"KILLSPREE_MSG_30";
				ps = randomInt(100);
				if(ps <= 25) { psnd = "ultrakill"; pmsg = &"KILLSPREE_ULTRA_KILL_PMSG"; }
				else if(ps > 25 && ps <= 50) { psnd = "godlike"; pmsg = &"KILLSPREE_GODLIKE_PMSG"; }
				else if(ps > 50 && ps <= 75) { psnd = "holyshit"; pmsg = &"KILLSPREE_HOLY_SHIT_PMSG"; }
				else if(ps > 75) { psnd = "slaughter"; pmsg = &"KILLSPREE_SLAUGHTER_PMSG"; }
			}

			if(self.ex_obmonamsg && isDefined(amsg))
			{
				if(level.IsLinuxServer) iprintln(amsg, attacker.name);
					else iprintln(amsg, attacker);
			}
			if(self.ex_obmonpmsg && isDefined(pmsg)) attacker iprintlnbold(pmsg);
			if(self.ex_obmonpsound && isDefined(psnd)) attacker playLocalSound(psnd);
		}
	}
}

weaponstreak(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc)
{
	self endon("disconnect");

	if(!isPlayer(attacker)) return;
	if(attacker.pers["team"] == self.pers["team"] && level.ex_teamplay) return;

	if(isDefined(attacker.pers["weaponname"]) && sWeapon == attacker.pers["weaponname"]) attacker.pers["weaponstreak"]++;
	else
	{
		attacker.pers["weaponstreak"] = 1;
		attacker.pers["weaponname"] = sWeapon;
	}

	attacker_weapon = getweaponstringname(attacker.pers["weaponname"]);

	if(attacker.pers["weaponstreak"] >= 5 && self.ex_obmonamsg)
	{
		amsg1 = undefined;
		amsg2 = undefined;

		if(attacker.pers["weaponstreak"] == 5) amsg1 = &"WEAPONSTREAK_MSG_5";
		else if(attacker.pers["weaponstreak"] == 10) amsg1 = &"WEAPONSTREAK_MSG_10";
		else if(attacker.pers["weaponstreak"] == 15) amsg1 = &"WEAPONSTREAK_MSG_15";
		else if(attacker.pers["weaponstreak"] == 20) amsg1 = &"WEAPONSTREAK_MSG_20";
		else if(attacker.pers["weaponstreak"] == 25) amsg1 = &"WEAPONSTREAK_MSG_25";
		else if(attacker.pers["weaponstreak"] == 30) amsg1 = &"WEAPONSTREAK_MSG_30";
		else if(attacker.pers["weaponstreak"] >= 35)
		{
			amsg1 = &"WEAPONSTREAK_MSG_35A";
			amsg2 = &"WEAPONSTREAK_MSG_35B";
		}

		if(isDefined(amsg1))
		{
				if(level.IsLinuxServer) iprintln(amsg1, attacker.name, attacker_weapon);
					else iprintln(amsg1, attacker, attacker_weapon);
		}
		if(isDefined(amsg2)) iprintln(amsg2, attacker.pers["weaponstreak"]);
	}
}

noobstreak(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc)
{
	self endon("disconnect");

	if(!isPlayer(attacker)) return;
	if(attacker.pers["team"] == self.pers["team"] && level.ex_teamplay) return;

	if(isDefined(attacker.pers["weaponname"]) && sWeapon == attacker.pers["weaponname"]) attacker.pers["noobstreak"]++;
	else
	{
		attacker.pers["noobstreak"] = 1;
		attacker.pers["weaponname"] = sWeapon;
	}

	attacker_weapon = getweaponstringname(attacker.pers["weaponname"]);
	if(attacker.pers["noobstreak"]%5==0) attacker.pers["spamkill"]++;

	if(attacker.pers["noobstreak"] >= 5 && self.ex_obmonamsg)
	{
		amsg1 = undefined;
		amsg2 = undefined;

		if(attacker.pers["noobstreak"] == 5) amsg1 = &"NOOBSTREAK_MSG_5";
		else if(attacker.pers["noobstreak"] == 10) amsg1 = &"NOOBSTREAK_MSG_10";
		else if(attacker.pers["noobstreak"] == 15) amsg1 = &"NOOBSTREAK_MSG_15";
		else if(attacker.pers["noobstreak"] == 20) amsg1 = &"NOOBSTREAK_MSG_20";
		else if(attacker.pers["noobstreak"] == 25) amsg1 = &"NOOBSTREAK_MSG_25";
		else if(attacker.pers["noobstreak"] == 30) amsg1 = &"NOOBSTREAK_MSG_30";
		else if(attacker.pers["noobstreak"] >= 35)
		{
			amsg1 = &"NOOBSTREAK_MSG_35A";
			amsg2 = &"NOOBSTREAK_MSG_35B";
		}

		if(isDefined(amsg1))
		{
				if(level.IsLinuxServer) iprintln(amsg1, attacker.name, attacker_weapon);
					else iprintln(amsg1, attacker, attacker_weapon);
		}
		if(isDefined(amsg2)) iprintln(amsg2, attacker.pers["noobstreak"]);
	}
}

consecdeath(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc)
{
	self endon("disconnect");

	if(!isPlayer(attacker)) return;
	if(attacker.pers["team"] == self.pers["team"] && level.ex_teamplay) return;

	if(self.pers["conseckill"] > 0) self.pers["conseckill"] = 0;
	self.pers["conseckill"]--;

	if(self.pers["conseckill"] <= -5 && self.ex_obmonamsg)
	{
		amsg = undefined;

		if(self.pers["conseckill"] == -5) amsg = &"CONSECDEATHS_MSG_5";
		else if(self.pers["conseckill"] == -8) amsg = &"CONSECDEATHS_MSG_8";
		else if(self.pers["conseckill"] == -10) amsg = &"CONSECDEATHS_MSG_10";
		else if(self.pers["conseckill"] == -13) amsg = &"CONSECDEATHS_MSG_13";
		else if(self.pers["conseckill"] <= -16) amsg = &"CONSECDEATHS_MSG_16";

		if(isDefined(amsg))
		{
			if(level.IsLinuxServer) iprintln(amsg, self.name);
				else iprintln(amsg, self);
		}
	}
}

getmessage(var)
{
	self endon("disconnect");

	if(!isDefined(var)) return undefined;

	msg = [];

	switch(var)
	{
		case "unknown":
			msg[0] = &"OBITUARY_UNKNOWN_MSG_0";
			msg[1] = &"OBITUARY_UNKNOWN_MSG_1";
			msg[2] = &"OBITUARY_UNKNOWN_MSG_2";
			break;

		case "falling":
			msg[0] = &"OBITUARY_FALLING_MSG_0";
			msg[1] = &"OBITUARY_FALLING_MSG_1";
			msg[2] = &"OBITUARY_FALLING_MSG_2";
			break;

		// mortar
		case "mortar":
			msg[0] = &"OBITUARY_MORTAR_MSG_0";
			msg[1] = &"OBITUARY_MORTAR_MSG_1";
			break;

		case "selfmortar":
			msg[0] = &"OBITUARY_MORTARSELF_MSG_0";
			break;

		// Napalm grenades
		case "firenade":
			msg[0] = &"OBITUARY_FIRENADE_MSG_0";
			msg[1] = &"OBITUARY_FIRENADE_MSG_1";
			msg[2] = &"OBITUARY_FIRENADE_MSG_2";
			break;

		case "pfirenade":
			msg[0] = &"OBITUARY_PFIRENADE_MSG_0";
			msg[1] = &"OBITUARY_PFIRENADE_MSG_1";
			break;

		case "firenadetk":
			msg[0] = &"OBITUARY_FIRENADETK_MSG_0";
			msg[1] = &"OBITUARY_FIRENADETK_MSG_1";
			break;

		case "selffirenade":
			msg[0] = &"OBITUARY_FIRENADESELF_MSG_0";
			break;

		// gas grenades
		case "gasnade":
			msg[0] = &"OBITUARY_GASNADE_MSG_0";
			msg[1] = &"OBITUARY_GASNADE_MSG_1";
			msg[2] = &"OBITUARY_GASNADE_MSG_2";
			break;

		case "pgasnade":
			msg[0] = &"OBITUARY_PGASNADE_MSG_0";
			msg[1] = &"OBITUARY_PGASNADE_MSG_1";
			break;

		case "gasnadetk":
			msg[0] = &"OBITUARY_GASNADETK_MSG_0";
			msg[1] = &"OBITUARY_GASNADETK_MSG_1";
			break;

		case "selfgasnade":
			msg[0] = &"OBITUARY_GASNADESELF_MSG_0";
			break;

		// satchel charges
		case "satchelcharge":
			msg[0] = &"OBITUARY_SATCHEL_MSG_0";
			msg[1] = &"OBITUARY_SATCHEL_MSG_1";
			msg[2] = &"OBITUARY_SATCHEL_MSG_2";
			break;

		case "psatchelcharge":
			msg[0] = &"OBITUARY_PSATCHEL_MSG_0";
			msg[1] = &"OBITUARY_PSATCHEL_MSG_1";
			break;

		case "satchelchargetk":
			msg[0] = &"OBITUARY_SATCHELTK_MSG_0";
			msg[1] = &"OBITUARY_SATCHELTK_MSG_1";
			break;

		case "selfsatchelcharge":
			msg[0] = &"OBITUARY_SATCHELSELF_MSG_0";
			break;

		// panzer
		case "panzer":
			msg[0] = &"OBITUARY_PANZER_MSG_0";
			msg[1] = &"OBITUARY_PANZER_MSG_1";
			break;

		case "ppanzer":
			msg[0] = &"OBITUARY_PPANZER_MSG_0";
			msg[1] = &"OBITUARY_PPANZER_MSG_1";
			break;

		case "panzertk":
			msg[0] = &"OBITUARY_PANZERTK_MSG_0";
			msg[1] = &"OBITUARY_PANZERTK_MSG_1";
			break;

		case "selfpanzer":
			msg[0] = &"OBITUARY_PANZERSELF_MSG_0";
			break;

		// bazooka
		case "bazooka":
			msg[0] = &"OBITUARY_BAZOOKA_MSG_0";
			msg[1] = &"OBITUARY_BAZOOKA_MSG_1";
			break;

		case "pbazooka":
			msg[0] = &"OBITUARY_PBAZOOKA_MSG_0";
			msg[1] = &"OBITUARY_PBAZOOKA_MSG_1";
			break;

		case "bazookatk":
			msg[0] = &"OBITUARY_BAZOOKATK_MSG_0";
			msg[1] = &"OBITUARY_BAZOOKATK_MSG_1";
			break;

		case "selfbazooka":
			msg[0] = &"OBITUARY_BAZOOKASELF_MSG_0";
			break;

		// flamethrower
		case "flamethrower":
			msg[0] = &"OBITUARY_FLAMETHROWER_MSG_0";
			msg[1] = &"OBITUARY_FLAMETHROWER_MSG_1";
			break;

		case "pflamethrower":
			msg[0] = &"OBITUARY_PFLAMETHROWER_MSG_0";
			msg[1] = &"OBITUARY_PFLAMETHROWER_MSG_1";
			break;

		case "flamethrowertk":
			msg[0] = &"OBITUARY_FLAMETHROWERTK_MSG_0";
			msg[1] = &"OBITUARY_FLAMETHROWERTK_MSG_1";
			break;

		case "selfflamethrower":
			msg[0] = &"OBITUARY_FLAMETHROWERSELF_MSG_0";
			break;

		// flammenwerfer
		case "flammenwerfer":
			msg[0] = &"OBITUARY_FLAMMENWERFER_MSG_0";
			msg[1] = &"OBITUARY_FLAMMENWERFER_MSG_1";
			break;

		case "pflammenwerfer":
			msg[0] = &"OBITUARY_PFLAMMENWERFER_MSG_0";
			msg[1] = &"OBITUARY_PFLAMMENWERFER_MSG_1";
			break;

		case "flammenwerfertk":
			msg[0] = &"OBITUARY_FLAMMENWERFERTK_MSG_0";
			msg[1] = &"OBITUARY_FLAMMENWERFERTK_MSG_1";
			break;

		case "selfflammenwerfer":
			msg[0] = &"OBITUARY_FLAMMENWERFERSELF_MSG_0";
			break;

		// knife
		case "knife":
			msg[0] = &"OBITUARY_KNIFE_MSG_0";
			msg[1] = &"OBITUARY_KNIFE_MSG_1";
			break;

		case "knifetk":
			msg[0] = &"OBITUARY_KNIFETK_MSG_0";
			msg[1] = &"OBITUARY_KNIFETK_MSG_1";
			break;

		case "knifeself":
			msg[0] = &"OBITUARY_KNIFESELF_MSG_0";
			break;

		case "knifewhip":
			msg[0] = &"OBITUARY_KNIFE_WHIP";
			break;

		case "knifewhiptk":
			msg[0] = &"OBITUARY_KNIFE_WHIP_TK";
			break;

		// plane
		case "plane":
			msg[0] = &"OBITUARY_PLANE_MSG_0";
			msg[1] = &"OBITUARY_PLANE_MSG_1";
			break;

		case "plane_bomb":
			msg[0] = &"OBITUARY_PLANE_BOMB_MSG_0";
			msg[1] = &"OBITUARY_PLANE_BOMB_MSG_1";
			break;

		// artillery
		case "selfartillery":
			msg[0] = &"OBITUARY_ARTILLERYSELF_MSG_0";
			break;

		// airstrike
		case "selfairstrike":
			msg[0] = &"OBITUARY_AIRSTRIKESELF_MSG_0";
			break;

		// napalm
		case "pnapalm":
			msg[0] = &"OBITUARY_PNAPALM_MSG_0";
			msg[1] = &"OBITUARY_PNAPALM_MSG_1";
			break;

		case "napalmtk":
			msg[0] = &"OBITUARY_NAPALMTK_MSG_0";
			msg[1] = &"OBITUARY_NAPALMTK_MSG_1";
			break;

		case "selfnapalm":
			msg[0] = &"OBITUARY_NAPALMSELF_MSG_0";
			break;

		// explosive
		case "explosive":
			msg[0] = &"OBITUARY_EXPLOSIVE_MSG_0";
			msg[1] = &"OBITUARY_EXPLOSIVE_MSG_1";
			break;

		case "explosivetk":
			msg[0] = &"OBITUARY_EXPLOSIVETK_MSG_0";
			msg[1] = &"OBITUARY_EXPLOSIVETK_MSG_1";
			break;

		// mine
		case "minefield":
			msg[0] = &"OBITUARY_MINEFIELD_MSG_0";
			msg[1] = &"OBITUARY_MINEFIELD_MSG_1";
			msg[2] = &"OBITUARY_MINEFIELD_MSG_2";
			break;

		// grenade
		case "selfnade":
			msg[0] = &"OBITUARY_SELFNADE_MSG_0";
			msg[1] = &"OBITUARY_SELFNADE_MSG_1";
			break;

		case "selfnades":
			msg[0] = &"OBITUARY_SELFNADES_MSG_0";
			msg[1] = &"OBITUARY_SELFNADES_MSG_1";
			break;

		// tripwire
		case "tripwire":
			msg[0] = &"OBITUARY_TRIPWIRE_MSG_0";
			msg[1] = &"OBITUARY_TRIPWIRE_MSG_1";
			break;

		case "tripwiretk":
			msg[0] = &"OBITUARY_TRIPWIRETK_MSG_0";
			msg[1] = &"OBITUARY_TRIPWIRETK_MSG_1";
			break;

		case "selftripwire":
			msg[0] = &"OBITUARY_TRIPWIRESELF_MSG_0";
			break;

		// landmine
		case "selflandmine":
			msg[0] = &"OBITUARY_LANDMINESELF_MSG_0";
			break;

		// pistol
		case "pistolwhip":
			msg[0] = &"OBITUARY_PISTOL_WHIP";
			break;

		case "pistolwhiptk":
			msg[0] = &"OBITUARY_PISTOL_WHIP_TK";
			break;

		// specials
		case "headshottk":
			msg[0] = &"OBITUARY_HEADSHOT_TK_MSG_0";
			msg[1] = &"OBITUARY_HEADSHOT_TK_MSG_1";
			break;

		case "sniper":
			msg[0] = &"OBITUARY_SNIPER_MSG_0";
			msg[1] = &"OBITUARY_SNIPER_MSG_1";
			break;

		case "snipertk":
			msg[0] = &"OBITUARY_SNIPER_TK_MSG_0";
			msg[1] = &"OBITUARY_SNIPER_TK_MSG_1";
			break;

		default:
			msg[0] = &"OBITUARY_WAS_KILLED_BY";
			break;

		// general bash
		case "bashkill_head":
			msg[0] = &"OBITUARY_BASHKILL_HEAD_MSG";
			break;

		case "bashkill":
			msg[0] = &"OBITUARY_BASHKILL_MSG_0";
			msg[1] = &"OBITUARY_BASHKILL_MSG_1";
			break;

		case "bashtk":
			msg[0] = &"OBITUARY_BASHTK_MSG_0";
			msg[1] = &"OBITUARY_BASHTK_MSG_1";
			break;

		// general teamkill
		case "teamkill":
			msg[0] = &"OBITUARY_TEAMKILL_MSG";
			break;

	}
	
	wm = randomInt(msg.size);
	return msg[wm];
}

// show personal message
showpmsgs(message)
{
	self endon("disconnect");

	if(!isDefined(message)) return undefined;
	
	pmsg = undefined;
	switch(message)
	{
		case "unknown":
			pmsg = &"OBITUARY_UNKNOWN_PMSG";
			break;

		case "falling":
			pmsg = &"OBITUARY_FALLING_PMSG";
			break;

		// mortars
		case "mortar":
		case "pmortar":
			pmsg = &"OBITUARY_MORTAR_PMSG";
			break;

		case "mortartk":
			pmsg = &"OBITUARY_MORTARTK_PMSG";
			break;

		case "selfmortar":
			pmsg = &"OBITUARY_MORTARSELF_PMSG";
			break;

		// Napalm grenades
		case "firenade":
		case "pfirenade":
			pmsg = &"OBITUARY_FIRENADE_PMSG";
			break;

		case "firenadetk":
			pmsg = &"OBITUARY_FIRENADETK_PMSG";
			break;

		case "selffirenade":
			pmsg = &"OBITUARY_FIRENADESELF_PMSG";
			break;

		// gas grenades
		case "gasnade":
		case "pgasnade":
			pmsg = &"OBITUARY_GASNADE_PMSG";
			break;

		case "gasnadetk":
			pmsg = &"OBITUARY_GASNADETK_PMSG";
			break;

		case "selfgasnade":
			pmsg = &"OBITUARY_GASNADESELF_PMSG";
			break;

		// panzer
		case "panzer":
		case "ppanzer":
			pmsg = &"OBITUARY_PANZER_PMSG";
			break;

		case "panzertk":
			pmsg = &"OBITUARY_PANZERTK_PMSG";
			break;

		case "selfpanzer":
			pmsg = &"OBITUARY_PANZERSELF_PMSG";
			break;

		// bazooka
		case "bazooka":
		case "pbazooka":
			pmsg = &"OBITUARY_BAZOOKA_PMSG";
			break;

		case "bazookatk":
			pmsg = &"OBITUARY_BAZOOKATK_PMSG";
			break;

		case "selfbazooka":
			pmsg = &"OBITUARY_BAZOOKASELF_PMSG";
			break;

		// flamethrower
		case "flamethrower":
		case "pflamethrower":
			pmsg = &"OBITUARY_FLAMETHROWER_PMSG";
			break;

		case "flamethrowertk":
			pmsg = &"OBITUARY_FLAMETHROWERTK_PMSG";
			break;

		case "selfflamethrower":
			pmsg = &"OBITUARY_FLAMETHROWERSELF_PMSG";
			break;

		// flammenwerfer
		case "flammenwerfer":
		case "pflammenwerfer":
			pmsg = &"OBITUARY_FLAMMENWERFER_PMSG";
			break;

		case "flammenwerfertk":
			pmsg = &"OBITUARY_FLAMMENWERFERTK_PMSG";
			break;

		case "selfflammenwerfer":
			pmsg = &"OBITUARY_FLAMMENWERFERSELF_PMSG";
			break;

		// satchel charge
		case "satchelcharge":
		case "psatchelcharge":
			pmsg = &"OBITUARY_SATCHEL_PMSG";
			break;

		case "satchelchargetk":
			pmsg = &"OBITUARY_SATCHELTK_PMSG";
			break;

		case "selfsatchelcharge":
			pmsg = &"OBITUARY_SATCHELSELF_PMSG";
			break;

		// knife
		case "knife":
		case "pknife":
			pmsg = &"OBITUARY_KNIFE_PMSG";
			break;

		case "knifetk":
			pmsg = &"OBITUARY_KNIFETK_PMSG";
			break;

		case "knifeself":
			pmsg = &"OBITUARY_KNIFESELF_PMSG";
			break;

		case "knifewhip":
			pmsg = &"OBITUARY_KNIFE_WHIP_PMSG";
			break;

		case "knifewhiptk":
			pmsg = &"OBITUARY_KNIFE_WHIP_TK_PMSG";
			break;

		// plane bomb
		case "plane":
			pmsg = &"OBITUARY_PLANE_PMSG";
			break;

		case "plane_bomb":
			pmsg = &"OBITUARY_PLANE_BOMB_PMSG";
			break;

		// artillery
		case "artillery":
			pmsg = &"OBITUARY_ARTILLERY_PMSG";
			break;

		case "artillerytk":
			pmsg = &"OBITUARY_ARTILLERYTK_PMSG";
			break;

		case "selfartillery":
			pmsg = &"OBITUARY_ARTILLERYSELF_PMSG";
			break;

		// airstrike
		case "pairstrike":
			pmsg = &"OBITUARY_AIRSTRIKE_PMSG";
			break;

		case "airstriketk":
			pmsg = &"OBITUARY_AIRSTRIKETK_PMSG";
			break;

		case "selfairstrike":
			pmsg = &"OBITUARY_AIRSTRIKESELF_PMSG";
			break;

		// napalm
		case "pnapalm":
			pmsg = &"OBITUARY_NAPALM_PMSG";
			break;

		case "napalmtk":
			pmsg = &"OBITUARY_NAPALMTK_PMSG";
			break;

		case "selfnapalm":
			pmsg = &"OBITUARY_NAPALMSELF_PMSG";
			break;

		// explosive
		case "explosive":
			pmsg = &"OBITUARY_EXPLOSIVE_PMSG";
			break;
			
		case "explosivetk":
			pmsg = &"OBITUARY_EXPLOSIVETK_PMSG";
			break;

		// mine
		case "minefield":
			pmsg = &"OBITUARY_MINEFIELD_PMSG";
			break;
		
		// grenade
		case "selfnade":
			pmsg = &"OBITUARY_SELFNADE_PMSG";
			break;
			
		case "selfnades":
			pmsg = &"OBITUARY_SELFNADES_PMSG";
			break;

		// tripwire
		case "tripwire":
			pmsg = &"OBITUARY_TRIPWIRE_PMSG";
			break;

		case "tripwiretk":
			pmsg = &"OBITUARY_TRIPWIRETK_PMSG";
			break;

		case "selftripwire":
			pmsg = &"OBITUARY_TRIPWIRESELF_PMSG";
			break;

		// pistol
		case "pistolwhip":
			pmsg = &"OBITUARY_PISTOL_WHIP_PMSG";
			break;

		case "pistolwhiptk":
			pmsg = &"OBITUARY_PISTOL_WHIP_TK_PMSG";
			break;

		// specials
		case "headshottk":
			pmsg = &"OBITUARY_HEADSHOT_TK_PMSG";
			break;

		case "sniper":
			pmsg = &"OBITUARY_SNIPER_PMSG";
			break;

		case "snipertk":
			pmsg = &"OBITUARY_SNIPER_TK_PMSG";
			break;

		// general bashes
		case "bashkill":
			pmsg = &"OBITUARY_BASHKILL_PMSG";
			break;
		
		case "bashkill_head":
			pmsg = &"OBITUARY_BASHKILL_HEAD_PMSG";
			break;

		case "bashtk":
			pmsg = &"OBITUARY_BASHTK_PMSG";
			break;

		// general teamkill
		case "teamkill":
			pmsg = &"OBITUARY_TEAMKILL_PMSG";
			break;

		default:
			return;
	}

	self iprintlnbold(pmsg);
}

gethitlocstringname(location)
{
	switch(location)
	{
		case "right_hand":      return &"HITLOC_RIGHT_HAND";
		case "left_hand":       return &"HITLOC_LEFT_HAND";
		case "right_arm_upper": return &"HITLOC_RIGHT_UPPER_ARM";
		case "right_arm_lower": return &"HITLOC_RIGHT_FOREARM";
		case "left_arm_upper":  return &"HITLOC_LEFT_UPPER_ARM";
		case "left_arm_lower":  return &"HITLOC_LEFT_FOREARM";
		case "head":            return &"HITLOC_HEAD";
		case "neck":            return &"HITLOC_NECK";
		case "right_foot":      return &"HITLOC_RIGHT_FOOT";
		case "left_foot":       return &"HITLOC_LEFT_FOOT";
		case "right_leg_lower": return &"HITLOC_RIGHT_LOWER_LEG";
		case "left_leg_lower":  return &"HITLOC_LEFT_LOWER_LEG";
		case "right_leg_upper": return &"HITLOC_RIGHT_UPPER_LEG";
		case "left_leg_upper":  return &"HITLOC_LEFT_UPPER_LEG";
		case "torso_upper":     return &"HITLOC_UPPER_TORSO";
		case "torso_lower":     return &"HITLOC_LOWER_TORSO";
		case "none":            return &"HITLOC_UNKNOWN";
		default:                return location;
	}
}

getweaponstringname(weapon)
{
	switch(weapon)
	{
		// american
		case "m1carbine_mp":    return &"GWEAPON_CARBINE";
		case "m1garand_mp":     return &"GWEAPON_GARAND";
		case "thompson_mp":     return &"GWEAPON_THOMPSON";
		case "bar_mp":          return &"GWEAPON_BAR";
		case "springfield_mp":  return &"GWEAPON_SPRINGFIELD";
		case "springfield_2_mp":  return &"GWEAPON_SPRINGFIELD_LR";
		case "greasegun_mp":    return &"GWEAPON_GREASEGUN";
		case "shotgun_mp":      return &"GWEAPON_SHOTGUN";
		case "colt_mp":         return &"GWEAPON_COLT";

		// british
		case "enfield_mp":      return &"GWEAPON_ENFIELD";
		case "sten_mp":         return &"GWEAPON_STEN";
		case "bren_mp":         return &"GWEAPON_BREN";
		case "enfield_scope_mp":return &"GWEAPON_ENFIELD_SCOPED";
		case "enfield_scope_2_mp":return &"GWEAPON_ENFIELD_SCOPED_LR";
		case "webley_mp":       return &"GWEAPON_WEBLEY";

		// russian
		case "mosin_nagant_mp": return &"GWEAPON_MOSIN_NAGANT";
		case "svt40_mp":        return &"GWEAPON_SVT40";
		case "pps42_mp":        return &"GWEAPON_PPS42";
		case "ppsh_mp":         return &"GWEAPON_PPSH";
		case "mosin_nagant_sniper_mp": return &"GWEAPON_MOSIN_NAGANT_SCOPED";
		case "mosin_nagant_sniper_2_mp": return &"GWEAPON_MOSIN_NAGANT_SCOPED_LR";
		case "tt30_mp":         return &"GWEAPON_TT30";

		// german
		case "kar98k_mp":       return &"GWEAPON_KAR98K";
		case "g43_mp":          return &"GWEAPON_GEWEHR43";
		case "g43_sniper":      return &"GWEAPON_GEWEHR43_SCOPED";
		case "g43_sniper_2":    return &"GWEAPON_GEWEHR43_SCOPED_LR";
		case "mp40_mp":         return &"GWEAPON_MP40";
		case "mp44_mp":         return &"GWEAPON_MP44";
		case "kar98k_sniper_mp":return &"GWEAPON_KAR98K_SCOPED";
		case "kar98k_sniper_2_mp": return &"GWEAPON_KAR98K_SCOPED_LR";
		case "luger_mp":        return &"GWEAPON_LUGER";
		case "panzerschreck_mp":return &"GWEAPON_PANZER";
		case "panzerschreck_allies": return &"GWEAPON_BAZOOKA";

		// flamethrowers
		case "flamethrower_allies": return &"GWEAPON_FLAMETHROWER";
		case "flamethrower_axis": return &"GWEAPON_FLAMMENWERFER";

		// turrets
		case "30cal_duck_mp":
		case "30cal_prone_mp":
		case "30cal_stand_mp":
		case "mobile_30cal":
			return &"GWEAPON_30CAL";

		case "mg42_bipod_duck_mp":
		case "mg42_bipod_prone_mp":
		case "mg42_bipod_stand_mp":
		case "mobile_mg42":
			return &"GWEAPON_MG42";

		// frag grenades
		case "frag_grenade_american_mp":
		case "frag_grenade_british_mp":
		case "frag_grenade_german_mp":
		case "frag_grenade_russian_mp":
			return &"GWEAPON_FRAG_GRENADE";

		// Satchel Charges
		case "smoke_grenade_american_satchel_mp":
		case "smoke_grenade_british_satchel_mp":
		case "smoke_grenade_german_satchel_mp":
		case "smoke_grenade_russian_satchel_mp":
		case "satchl_mp":
			return &"GWEAPON_SATCHEL_CHARGE";

		// Gas grenades
		case "smoke_grenade_american_gas_mp":
		case "smoke_grenade_british_gas_mp":
		case "smoke_grenade_german_gas_mp":
		case "smoke_grenade_russian_gas_mp":
		case "gas_mp":
			return &"GWEAPON_GAS_GRENADE";

		// Napalm grenades
		case "smoke_grenade_american_fire_mp":
		case "smoke_grenade_british_fire_mp":
		case "smoke_grenade_german_fire_mp":
		case "smoke_grenade_russian_fire_mp":
		case "fire_mp":
			return &"GWEAPON_FIRE_GRENADE";

		// knife
		case "knife_mp":
			return &"GWEAPON_KNIFE";

		// landmine
		case "landmine_mp":
			return &"GWEAPON_LANDMINE";

		default: return &"GWEAPON_UNKNOWN";
	}
}
