init()
{
	// Draws a team icon over teammates
	level.drawfriend = [[level.ex_drm]]("scr_drawfriend", 1, 0, 1, "int");

	// Force respawning
	level.forcerespawn = [[level.ex_drm]]("scr_forcerespawn",0,0,1,"int");

	// if death music is on, this overrides forcespawn
	if(level.forcerespawn && level.ex_deathmusic)
	{
		setCvar("scr_forcerespawn", "0");
		level.forcerespawn = false;
	}

	// Auto Team Balancing
	level.teambalance = [[level.ex_drm]]("scr_teambalance",1,0,1,"int");

	// Time limit per map
	level.timelimit = [[level.ex_drm]]("scr_" + level.ex_currentgt + "_timelimit", 30, 0, 1440, "float");

	// Score limit per map
	level.scorelimit = [[level.ex_drm]]("scr_" + level.ex_currentgt + "_scorelimit",1,1,999,"int");

	if(level.ex_roundbased)
	{
		// round limit
		level.roundlimit = [[level.ex_drm]]("scr_" + level.ex_currentgt+ "_roundlimit",5,0,21,"int");

		// round length
		level.roundlength = [[level.ex_drm]]("scr_" + level.ex_currentgt+ "_roundlength",10,1,60,"float");

		// grace period
		level.graceperiod = [[level.ex_drm]]("scr_" + level.ex_currentgt+ "_graceperiod",0,0,60,"float");

		// bomb timer?
		if(level.ex_currentgt == "sd")
		{
			level.bombtimer = [[level.ex_drm]]("scr_sd_bombtimer",60,30,120,"int");
			level.planttime = [[level.ex_drm]]("scr_sd_planttime",5,1,30,"int");
			level.defusetime = [[level.ex_drm]]("scr_sd_defusetime",10,1,30,"int");
		}
	}
	else if(level.ex_currentgt == "htf")
	{
		level.mode = [[level.ex_drm]]("scr_htf_mode", 0, 0, 3, "int");												// balance mode
		level.holdtime = [[level.ex_drm]]("scr_htf_holdtime", 90, 1, 999, "int");								// flag hold time
		level.flagrecovertime = [[level.ex_drm]]("scr_htf_flagrecovertime", 0, 0, 999, "int");			// flag recover time
		level.flagspawndelay = [[level.ex_drm]]("scr_htf_flagspawndelay", 15, 0, 999, "int");			// flag spawn delay
		level.removeflagspawns = [[level.ex_drm]]("scr_htf_removeflagspawns", 0, 0, 1, "int");	// Remove spawnpoint which is used by the flag?
	}

	// player spawn delay?
	if(level.ex_currentgt == "ctf" || level.ex_currentgt == "htf") level.respawndelay = [[level.ex_drm]]("scr_" + level.ex_currentgt + "_spawndelay",0,0,60,"int");

	// additional cvars for gametypes
	if(level.ex_currentgt == "hq")
	{
		level.ex_hq_radio_zradius = [[level.ex_drm]]("ex_hq_radio_zradius", 6, 0, 12, "int") * 12;			// height radius for radio (in feet)
		level.ex_hq_radio_spawntime = [[level.ex_drm]]("ex_hq_radio_spawntime", 45, 0, 240, "int");	// spawn time for radio
		level.ex_hq_radio_holdtime = [[level.ex_drm]]("ex_hq_radio_holdtime", 120, 10, 1440, "int");	// holdtime for radio
		level.ex_hq_respawn_time = [[level.ex_drm]]("ex_hq_respawn_time", 10, 1, 240, "int");			// respawn time for player
		level.ex_hqpoints_teamneut = [[level.ex_drm]]("ex_hqpoints_teamneut", 10, 0, 999, "int");		// team neutralize radio points
		level.ex_hqpoints_playerneut = [[level.ex_drm]]("ex_hqpoints_playerneut", 2, 0, 999, "int");	// player neutralize radio points
		level.ex_hqpoints_teamcap = [[level.ex_drm]]("ex_hqpoints_teamcap", 0, 0, 999, "int");			// team radio capture points
		level.ex_hqpoints_playercap = [[level.ex_drm]]("ex_hqpoints_playercap", 2, 0, 999, "int");		// player radio capture points
		level.ex_hqpoints_defpps = [[level.ex_drm]]("ex_hqpoints_defpps", 1, 0, 999, "int");				// defending team points per second
	}
	else if(level.ex_currentgt == "chq")
	{
		level.ex_chq_radio_zradius = [[level.ex_drm]]("ex_chq_radio_zradius", 6, 0, 12, "int") * 12;			// height radius for radio (in feet)
		level.ex_chq_radio_spawntime = [[level.ex_drm]]("ex_chq_radio_spawntime", 45, 0, 240, "int");	// spawn time for radio
		level.ex_chq_radio_holdtime = [[level.ex_drm]]("ex_chq_radio_holdtime", 120, 60, 1440, "int");	// holdtime for radio
		level.ex_chqpoints_teamneut = [[level.ex_drm]]("ex_chqpoints_teamneut", 10, 0, 999, "int");		// team neutralize radio points
		level.ex_chqpoints_playerneut = [[level.ex_drm]]("ex_chqpoints_playerneut", 2, 0, 999, "int");		// player neutralize radio points
		level.ex_chqpoints_teamcap = [[level.ex_drm]]("ex_chqpoints_teamcap", 0, 0, 999, "int");			// team radio capture points
		level.ex_chqpoints_playercap = [[level.ex_drm]]("ex_chqpoints_playercap", 2, 0, 999, "int");		// player radio capture points
		level.ex_chqpoints_defpps = [[level.ex_drm]]("ex_chqpoints_defpps", 1, 0, 999, "int");					// defending team points per second
	}
	else if(level.ex_currentgt == "ctf")
	{
		level.ex_ctfpoints_teamcf = [[level.ex_drm]]("ex_ctfpoints_teamcf", 1, 0, 999, "int");			// team capture points
		level.ex_ctfpoints_playercf = [[level.ex_drm]]("ex_ctfpoints_playercf", 10, 0, 999, "int");	// player capture points
		level.ex_ctfpoints_playerrf = [[level.ex_drm]]("ex_ctfpoints_playerrf", 2, 0, 999, "int");		// player return flag points
	}
	else if(level.ex_currentgt == "sd")
	{
		level.ex_sdpoints_plant = [[level.ex_drm]]("ex_sdpoints_plant", 0, 0, 999, "int");			// points for planting a bomb
		level.ex_sdpoints_defuse = [[level.ex_drm]]("ex_sdpoints_defuse", 0, 0, 999, "int");		// points for defusing a bomb
	}
	else if(level.ex_currentgt == "ihtf")
	{
		level.HoldTimeToScore = [[level.ex_drm]]("scr_ihtf_holdtimetoscore", 10, 1, 99999, "int");	// flag hold time
		level.PointsForHoldingFlag = [[level.ex_drm]]("scr_ihtf_pointsforholdingflag", 2, 0, 100, "int");
		level.flagspawndelay = [[level.ex_drm]]("scr_ihtf_flagspawndelay", 15, 0, 9999, "int");			// flag spawn delay
		level.respawndelay = [[level.ex_drm]]("scr_ihtf_respawndelay", 10, 0, 600, "int");	// Remove spawnpoint which is used by the flag?
	}
}

createClock()
{
	level.clock = newHudElem();

	clockx = 8;
	clocky = 2;
	halign = "left";
      font = 2;

	if(level.ex_logopic)
	{
		clockx = 320;
		halign = "center";
            font = 1;
	}
      if(level.ex_logopic && (level.ex_currentgt == "lms" || level.ex_currentgt == "htf" || level.ex_currentgt == "ihtf" || level.ex_currentgt == "dom" || level.ex_currentgt == "ons"))
      { 
            clockx = 616;
            clocky = 1;
            font = 1;
      }

	level.clock.alignX = halign;
	level.clock.alignY = "top";
	level.clock.x = clockx;
	level.clock.y = clocky;
	level.clock.font = "default";
	level.clock.sort = 0;
	level.clock.fontscale = font;

	if(level.ex_timeannouncer != 2 && isDefined(level.clock)) level.clock.color = (0,1,0);
}
