SA-MP Forums Archive
30 Percent - 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)
+--- Thread: 30 Percent (/showthread.php?tid=343607)



30 Percent - Kitten - 18.05.2012

Solved


Re: 30 Percent - iRage - 18.05.2012

Post the function you made


Re: 30 Percent - Kitten - 18.05.2012

Solved


Re: 30 Percent - iRage - 18.05.2012

"i've tried to loop players or make a custom function name GetTeamPlayersAlive, did not work either"....


Anyways, how to you define players type?
And what is the percentage of players you want to become zombies on a new round's start?


Re: 30 Percent - Kitten - 18.05.2012

Solved


Re: 30 Percent - iRage - 18.05.2012

I suppose the team for zombies is TEAM_ZOMBIE?


Re: 30 Percent - Kitten - 18.05.2012

Quote:
Originally Posted by iRage
Посмотреть сообщение
I suppose the team for zombies is TEAM_ZOMBIE?
Yes, correct.


Re: 30 Percent - iRage - 18.05.2012

Alright, the following will make a ratio of 1:1

pawn Код:
new Humans, Zombies, rand = random(2);
if(rand == 0) // Setting ID 0 to Human and continuing with the cycle
{
    foreach(Player, i)
    {
        if(Humans == Zombies)
        {
            gTeam[i] = TEAM_HUMAN;
            Humans ++;
        }
        else
        {
            gTeam[i] = TEAM_ZOMBIE;
            Zombies ++;
        }
    }
}
else // Setting ID 0 to Zombie and continuing with the cycle
{
    foreach(Player, i)
    {
        if(Humans == Zombies)
        {
            gTeam[i] = TEAM_ZOMBIE;
            Zombies ++;
        }
        else
        {
            gTeam[i] = TEAM_HUMAN;
            Humans ++;
        }
    }
}