This is the original stock:
Code:
stock update_alive_count( )
{
g_iTerroristCount = 0;
g_iCTCount = 0;
new Players[32], playerCount, id;
get_players( Players, playerCount );
for( new i = 1; i <= playerCount; i++ )
{
id = Players[i];
if( !is_user_alive( id ) )
continue;
switch( cs_get_user_team( id ) )
{
case CS_TEAM_T:
{
g_iTerroristCount++;
}
case CS_TEAM_CT:
{
g_iCTCount++;
}
}
}
}
But because that one wasn't working i made the second loop and then it worked. So i added some client_print's to see what's wrong and ended up with this.
Code:
stock update_alive_count( )
{
g_iTerroristCount = 0;
g_iCTCount = 0;
new Players[32], playerCount, id;
get_players( Players, playerCount );
for( new i = 1; i <= playerCount; i++ )
{
id = Players[i];
if( !is_user_alive( id ) )
continue;
switch( cs_get_user_team( id ) )
{
case CS_TEAM_T:
{
g_iTerroristCount++;
}
case CS_TEAM_CT:
{
g_iCTCount++;
}
}
}
client_print(0, print_chat, "loop 1 %i ct and %i terro", g_iCTCount, g_iTerroristCount);
for( new i = 0; i < playerCount; i++ )
{
id = Players[i];
if( !is_user_alive( id ) )
continue;
switch( cs_get_user_team( id ) )
{
case CS_TEAM_T:
{
g_iTerroristCount++;
}
case CS_TEAM_CT:
{
g_iCTCount++;
}
}
}
client_print(0, print_chat, "loop 2 %i ct and %i terro", g_iCTCount, g_iTerroristCount);
}
__________________