Have you looked at the actual values for the two counters? It could very
well be that the ToHL2MPPlayer() part fails, and therefore the amount of
"alive" players is incorrect. Maybe try putting the
"playercountertotal++;" in a conditional with ToHL2MPPlayer() too?
Yorg Kuijs wrote:
> Hey list,
>
> so after several changes to last man standing and last team standing
> gamemodes a weird problem started occuring during tests that we didn't
> encounter before.
>
> Basically if there's more then 2 people playing and only 1 still has
> "lives" left then the game ends, the problem is when there is 3 or more
> that it sometimes end after only guy lost all of his lives while its
> supposed to end after all have lost their lives except 1.
>
> Here's the code I'm using for the Last Man Standing part, the Last Team
> Standing part is very similar... also very weird is that sometimes it
> DOES work properly, can't find the problem though, so please take a look
> and tell me what's wrong:
>
> if ( pPlayer )
> playercountertotal++;
> if( pPlayer && ToHL2MPPlayer(pPlayer)->GetPlayerLives()>0)
> playercounter++;
>
> if ( playercountertotal>=2 && playercounter == 1 )
> {
> GoToIntermission2();
> UTIL_ClientPrintAll( HUD_PRINTCENTER, "Player X Wins");
> UTIL_ClientPrintAll( HUD_PRINTCONSOLE, "Player X Won" );
> return;
> }
> else if ( playercountertotal>=2 && playercounter <= 0 )
> {
> GoToIntermission2();
> UTIL_ClientPrintAll( HUD_PRINTCENTER, "The round is a
> draw");
> UTIL_ClientPrintAll( HUD_PRINTCONSOLE, "The round was a
> draw" );
> return;
> }
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders