04-08-2012, 12:36
(04-07-2012, 21:45)surtek Wrote: I have found the problem.
Problem:
Code:getNumSurvivors()
{
numSurvivors = 0;
foreach ( player in level.players )
{
if ( player.team == "allies" )
numSurvivors++;
}
return numSurvivors;
}
It counts every players that belongs to the "allies" (team). Each player will add 1 to "numSurvivors". The problem is, that this function doesn't add -1 if a player loses connection or leaves.
How to solve:
Make a check how many players are really left each 2 seconds or something. Than put this amount in "numSurvivors".
I hope this helped you.
No. This isn't true. It checks the number of survivors every time an infected kills a player. Then it does if(survivorCount == 0) -> last survivor died, infected won.