I've used a player counting script from this forum and it works how I want
it to, but the problem is it doesn't take into account players in spectator
and only if there is 1 player on the map.
What I want it to do is count the alive players on each team and then run
a thread to play a sound when there are either no allies or axis left alive.
What it does at the moment is to play the sounds when you join the game
as both axis and allies players are nil.
When I select a side it will see that there are no opposition players and
run the win thread .
With 2 ppl on the map it runs as it should
It's a SH obj map the thread is below.
Please could somebody point me in the right direction as to what I need
to add so that it accounts for players in spectator and only 1 player on the map, waiting for others to join?
Thanks in advance!
Code: Select all
count_players:
while(1)
{
level.allies = 0
level.axis = 0
for(local.i=1;local.i<=$player.size;local.i++)
{
if(isAlive $player[local.i])
{
if($player[local.i].dmteam=="allies")
{
level.allies++
}
else if($player[local.i].dmteam=="axis")
{
level.axis++
}
}
}
}
if (level.allies == 0)
{
thread allies_dead
}
if (level.axis == 0)
{
thread axis_dead
}
wait 1
}
end
allies_dead:
wait 2
$axis_win_speaker playsound axis_win_snd
teamwin axis
end
axis_dead:
wait 2
$allies_win_speaker playsound allies_win_snd
teamwin allies
end

