The whole thing is in a for loop:
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
so for every player it adds 1 to playercounter or playercountertotal.
and you mean something like this then?:
if ( pPlayer )
playercountertotal++;
if( pPlayer && ToHL2MPPlayer(pPlayer) &&
ToHL2MPPlayer(pPlayer)->GetPlayerLives()>0)
playercounter++;
Nuno Silva wrote:
> I'm no pro at Source Modding, but this piece of code looks kind of weird.
> Please notice that i dont do any Source SDK work, so i might be wrong.
>
> How are you getting pPlayer? Because it feels irrational that
> playercounter++ would be >= 2.
>
> Also, what Willem Engel means is that you should do something like this:
>
> if ( pPlayer && ToHL2MPPlayer(pPlayer) &&
> ToHL2MPPlayer(pPlayer)->GetPlayerLives()>= 0 )
>
> Because if ToHL2MPPlayer fails, you'll probably be accessing a null pointer,
> though that may not be the case since you dont mention any crashes.
>
> Also, shouldnt it be > instead of >=?
>
> Sorry if this reply doesnt help much. As i said, i dont code on the SDK
> nowadays. Good luck.
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders