All == TEAM_HUMAN
#1

Solved
Reply
#2

Start some playercounting on each team

pawn Код:
new zPlayers, hPlayers;
now, find the codes where when a person chooses that class there a zombie or human and add zPlayers++ on the zombies side and hPlayers++; on the humans side of code, then set a repeating timer to detect if there are no players in the team zombies and no players in the in the team humans... thats just the beginning although i really i dont think i can think about how to grab 3 random players from the zombie/human team. I hope i made sense D:
Reply
#3

pawn Код:
new NonZombieCount;
#define MIN_NONZOMBIES 3
foreach( Player, i )
{
    if( PlayerTeam[i] != ZOMBIE_TEAM ) NonZombieCount++;
    if( NonZombieCount >= MIN_NONZOMBIES ) break;
}
if( NonZombieCount >= MIN_NONZOMBIES )
{
    new PlayersAssigned, pID;
    do{
        pID = Iter_Random(Player);
        if( PlayerTeam[pID] == ZOMBIE_TEAM )
        {
            PlayerTeam[pID] = HUMAN_TEAM;
            PlayersAssigned++;
        }
    }
    while( PlayersAssigned >= MIN_NONZOMBIES );
}
#undef MIN_NONZOMBIES
Something like that.

EDIT: Sorry, just woke. Gimme a sec.
EDIT2:
pawn Код:
new NonZombieCount;
foreach( Player, i )
{
    if( PlayerTeam[i] != ZOMBIE_TEAM ) NonZombieCount++;
}
if( !NonZombieCount )
{
    new PlayersAssigned, pID;
    do{
        pID = Iter_Random(Player);
        if( PlayerTeam[pID] == ZOMBIE_TEAM )
        {
            PlayerTeam[pID] = HUMAN_TEAM;
            PlayersAssigned++;
        }
    }
    while( PlayersAssigned >= MIN_NONZOMBIES );
}
Reply
#4

Or just return 0 at OnPlayerRequest spawn when it appears that one team contains more players then the other, no need for stupido timers.
Reply
#5

pawn Код:
forward Human(playerid);

SetTimer("Human", 2000,1);

public Human(playerid)
{
    if(gTeam[playerid] == TEAM_ZOMBIE)
{
// Register here if so many players in the team are to change it
gTeam[playerid] = TEAM_HUMAN;
return 1;
}
return 1;
}
Reply
#6

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Or just return 0 at OnPlayerRequest spawn when it appears that one team contains more players then the other, no need for stupido timers.
How does that put 3 players into human team, when all players are in zombie team?
Players don't need to respawn to become zombies. And he doesn't want them to not be able to spawn..
(maybe they do need to respawn, I don't know how the GM works, but still.)

No one has even mentioned any timers. The code I posted, which is really basicly the same as Lorenc_ suggested, can be put for example under function which makes players zombies. There is no need for timers. Although it can work with a timer. Even then, a 5 second timer is sufficent and nothing resource hungry.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)