init(x)
{
	if(level.freeRun)
		return;
	thread Hud();
	thread OnIntermission();
	thread OnEndRound();
}
OnIntermission()
{
	level waittill("intermission");
	if(isDefined(level.hud_xpevent))
	{
		level.hud_xpevent fadeOverTime(3);
		level.hud_xpevent.glowAlpha = 0;
		level.hud_xpevent.Alpha = 0;
		wait 1;
		level.hud_xpevent destroy();
	}
}
OnEndRound()
{
	level waittill("endround");
	if(isDefined(level.hud_xpevent))
	{
		level.hud_xpevent fadeOverTime(1);
		level.hud_xpevent.glowAlpha = 0;
		level.hud_xpevent.Alpha = 0;
		wait 1;
		level.hud_xpevent destroy();
	}
}
Hud()
{
	level endon("intermission");
	if(isDefined(level.hud_xpevent))
		level.hud_xpevent destroy();
			
	level.hud_xpevent = newHudElem();
    level.hud_xpevent.foreground = true;
	level.hud_xpevent.alignX = "center";
	level.hud_xpevent.alignY = "bottom";
	level.hud_xpevent.horzAlign = "center";
    level.hud_xpevent.vertAlign = "bottom";
    level.hud_xpevent.x = 0;
    level.hud_xpevent.y = -7;
    level.hud_xpevent.sort = 5;
  	level.hud_xpevent.fontScale = 1.5;
	self.hud_xpevent.color = (1, 1, 1);
	self.hud_xpevent.font = "objective";
	self.hud_xpevent.glowColor = level.randomcolour;
	self.hud_xpevent.glowAlpha = 1;
 	level.hud_xpevent.hidewheninmenu = true;
	while(1)
	{
		players = getEntArray("player","classname");
		players = int(players.size);
		
		
		if(players >= 5  && players <= 10)
		{
			if(isDefined(level.hud_xpevent))
				level.hud_xpevent setText("^5D^7oubl^5e ^5X^7P ^5A^7ctivate^5d ^7(^55^7/^55^7)");
			thread DoubleXp();
		}
		else if(players < 5)
		{
			if(isDefined(level.hud_xpevent))
				level.hud_xpevent setText("^5A^7ctiv^5e ^5p^7layer^5s ^5u^7ntil^5l ^5X^7P ^5e^7ven^5t^7: ^5" + players + "/5");
			thread NormalXp();
		}
		else if(players > 10)
		{
			if(isDefined(level.hud_xpevent))
				level.hud_xpevent setText("^5T^7ripl^5e ^5X^7P ^5A^7ctivate^5d ^7(^510^7/^510^7)");
			thread TripleXp();
		}
		wait 3;

	}
}
DoubleXp()
{
	level.scoreInfo["kill"]["value"] = 300;
	level.scoreInfo["headshot"]["value"] = 500;
	level.scoreInfo["melee"]["value"] = 500;
	level.scoreInfo["activator"]["value"] = 200;
	level.scoreInfo["trap_activation"]["value"] = 40;
	level.scoreInfo["jumper_died"]["value"] = 80;
}
NormalXp()
{
	level.scoreInfo["kill"]["value"] = 200;
	level.scoreInfo["headshot"]["value"] = 400;
	level.scoreInfo["melee"]["value"] = 300;
	level.scoreInfo["activator"]["value"] = 100;
	level.scoreInfo["trap_activation"]["value"] = 20;
	level.scoreInfo["jumper_died"]["value"] = 40;
}
TripleXp()
{
	level.scoreInfo["kill"]["value"] = 400;
	level.scoreInfo["headshot"]["value"] = 600;
	level.scoreInfo["melee"]["value"] = 600;
	level.scoreInfo["activator"]["value"] = 300;
	level.scoreInfo["trap_activation"]["value"] = 60;
	level.scoreInfo["jumper_died"]["value"] = 120;
}