Count number of axis players

Post your scripting questions / solutions here

Moderator: Moderators

agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

anyway my map is not a tow and i tried to set targetnames to my info player , they are still able to spawn :oops: .

Where the hell in tow script or tow_dm.scr it is written the comand to disable them to spawn.

Nothing in tow_map_name_script or tow_dm.scr ......
Deadly and slient.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Maby my player scanner from the Liberation version of "The Canal" will help:

Code: Select all

player_scanner:
	while (true)
	{
		level.allies_in_game = 0
		level.axis_in_game = 0
		level.allies_in_prison = 0
		level.axis_in_prison = 0
		for(local.i = 1; local.i <= $player.size; local.i++)
		{
			waitthread detect_player_status $player[local.i]
			waitframe
		}
		waitthread test_winning_conditions
		wait 1
	}
end

detect_player_status local.player:
	// Test if the player has spawned into the map, or are still choosing weapon
	local.trigger = spawn trigger_multiple "targetname" "player_position_trigger" setthread player_exists_setthread
	local.trigger.origin = local.player.origin
	waitframe
	waitframe
	waitframe
	$player_position_trigger delete
	if(local.player.activated && isAlive local.player)
	{
		if(local.player.dmteam == allies)
		{
			level.allies_in_game++
			if(local.player istouching $axis_prison_volume)
			{
				level.allies_in_prison++
			}
		}
		else
		{
			if(local.player.dmteam == axis)
			{
				level.axis_in_game++
				if(local.player istouching $allied_prison_volume)
				{
					level.axis_in_prison++
				}
			}
			else
			{
				if(local.player.dmteam == spectator)
				{
					iprintln "Spectating player detected " local.player.dmteam
					local.player.activated = false
				}
				else
				{
					iprintln "Undefined player detected " local.player.dmteam
					local.player.activated = false
				}
			}
		}
	}
end
Get the map (with the complete script) here.
Admin .MAP Forums
Image
Head above heels.
Post Reply