SA-MP Forums Archive
get ALL players team ... is that posible ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: get ALL players team ... is that posible ? (/showthread.php?tid=251297)



get ALL players team ... is that posible ? - Amine_Mejrhirrou - 26.04.2011

is there any way to check if all the players (the online players ofcours) are in the same team
i mad this but I'm petty sure that's not correct
so all the ideas for this are welcome
Код:
    for(new I = 0; I < MAX_PLAYERS; I++) 
    {
           if GetPlayerTeam(i) == 1
           {  
                   new Winner = random(i);
                   SetPlayerTeam(Winner, 2);
                   SetPlayerHealth(Winner, 0);
            }
    }



Re: get ALL players team ... is that posible ? - Raimis_R - 26.04.2011

Look i created a function:

pawn Код:
stock GetPlayersFromTeam(TeamID)
{
    for(new I = 0; I < MAX_PLAYERS; I++)
    {
        if(!IsPlayerConnected(I)) continue;
        new
            Count = 0;
        if(GetPlayerTeam(I) == TeamID)
        {
            Count++;
        }
    }
    return Count;
}



Re : get ALL players team ... is that posible ? - Amine_Mejrhirrou - 26.04.2011

what this fuction do ?


Re: get ALL players team ... is that posible ? - Raimis_R - 26.04.2011

Example:

printf("In Red TM players:%i",GetPlayersFromTeam(1));

And will count all players in red team


Re : get ALL players team ... is that posible ? - Amine_Mejrhirrou - 26.04.2011

thanks this will be helpful