Team Balance
#1

Hello how to make this team balance random without that it is chosing after ID's?

Код:
stock TeamBalance()
{
	new Humans;
	foreach(Player, i)
	{
	    if(Humans < 3)
	    {
	        HumanSetup(i);
	        printf("Selected humans");
	        Humans ++;
	    }
	    else
	    {
	        ZombieSetup2(i);
	        printf("Selected zombies");
	        Humans = 0;
	    }
	}
	printf("Finished Selecting teams");
	return 1;
}
Reply
#2

foreach or y_iterrate have a random feature, use it.

pawn Код:
Iter_Random(Player); //for players but if you have your own iter., than you can specify that instead of Player
And i completely recommend you to create your own iterrate for team humans!

pawn Код:
stock TeamBalance()
{
    new Humans;
    foreach(Player, i)
    {
        if(Humans < 3)
        {
            HumanSetup(i);
            printf("Selected humans");
            Humans ++;
        }
        else
        {
            new randomzombie = Iter_Random(Player);
            if(GetPlayerTeam(i) == TEAM_HUMANS)
            {
                ZombieSetup2(randomzombie);
                printf("Selected zombies");
                Humans = 0;
            }
            else //make this timer run again or if its already dependent on "Humans=0", than ignore.
        }
    }
    printf("Finished Selecting teams");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)