View Single Post
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 05-12-2020 , 23:51   Re: Stock to detect when a team dies
Reply With Quote #3

thanks for your help but I use infinite round (from a module of dias called InfinityGame) so I need a stock that is called in an if to detect when a team is dead and finish the round, that's how I use it but sometimes it doesn't work and bug the round.

PHP Code:
public Check_Gameplay()
{
        if((
Get_PlayerCount(11) <= 0) && !pev_valid(g_TerroristBase)) // All terrorist are dead
        
{
                
Game_Ending(5.00CS_TEAM_CT)
 
                return
        }
        else if((
Get_PlayerCount(12) <= 0) && !pev_valid(g_CTBase)) // All CT are dead
        

                
Game_Ending(5.00CS_TEAM_T)
               
                return
        }
}

stock Get_PlayerCount(AliveTeam)
// Alive: 0 - Dead | 1 - Alive | 2 - Both
// Team: 1 - T | 2 - CT
{
        new 
Flag[4], Flag2[12]
        new 
Players[32], PlayerNum
 
        
if(!Aliveformatex(Flagsizeof(Flag), "%sb"Flag)
        else if(
Alive == 1formatex(Flagsizeof(Flag), "%sa"Flag)
       
        if(
Team == 1)
        {
                
formatex(Flagsizeof(Flag), "%se"Flag)
                
formatex(Flag2sizeof(Flag2), "TERRORIST"Flag)
        } 
        else if(
Team == 2)
        {
                
formatex(Flagsizeof(Flag), "%se"Flag)
                
formatex(Flag2sizeof(Flag2), "CT"Flag)
        }
       
        
get_players(PlayersPlayerNumFlagFlag2)
       
        return 
PlayerNum

I found that stock in a code that is not mine

Last edited by wicho; 05-12-2020 at 23:52.
wicho is offline