
main()
{
	while(game["ex_emptytime"] < level.ex_rotateifempty)
	{
		wait 60;
		num = 0;
		players = getentarray("player", "classname");

		// Count clients that are playing
		for(i=0;i<players.size;i++)
		if(isdefined(players[i]) && isPlayer(players[i]) && players[i].sessionstate == "playing")
			num++; 

		// Need at least 1 playing clients			
		if(num >= 1)
			game["ex_emptytime"] = 0;
		else
			game["ex_emptytime"]++;
	}
	exitLevel(false);
}