SA-MP Forums Archive
how to check if all players in 1 team - 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: how to check if all players in 1 team (/showthread.php?tid=178209)



how to check if all players in 1 team - Kitten - 21.09.2010

Solved


Re: how to check if all players in 1 team - Steven82 - 21.09.2010

Would it be so special that it would kill you to explain more FFS no one really wants to steal your code, honestly it's prob. not that awesome(No offense)

But anyways, are you wanting to switch half the players from TEAM_ZOMBIE to TEAM_HUMAN or something?


Re: how to check if all players in 1 team - bigcomfycouch - 21.09.2010

pawn Код:
myFunc()
{
    new
        allZombie = 1;
    for (new i; i < MAX_PLAYERS; ++i)
    {
        if (!IsPlayerConnected(i)) continue;
        if (GetPlayerTeam(i) != TEAM_ZOMBIE) allZombie = 0, break;
    }

    if (allZombie)
    {
        // everyone is a zombie
    }
    else
    {
        // at least 1 non-zombie
    }
}
use foreach instead of the for loop I've used if you use foreach


Re: how to check if all players in 1 team - Kitten - 21.09.2010

Solved


Re: how to check if all players in 1 team - bigcomfycouch - 21.09.2010

ya

The message you have entered is too short. Please lengthen your message to at least 8 characters.


Re: how to check if all players in 1 team - Kitten - 21.09.2010

Solved


Re: how to check if all players in 1 team - Jacob74 - 21.09.2010

use a variable. put the variable of all of the teams to 1. then loop, and find which players have the variable you made set a 1.