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



Chose Team - arlindi - 11.02.2015

Hello i want to create randomid can been choosen
I want the random id can got just by TEAM_ZOMBIE
Randomid from TEAM_ZOMBIE not chose someone from TEAM_RED

Ok ? Understand
Thnx


Re: Chose Team - CalvinC - 11.02.2015

I don't really understand you, but use random to create a random chance of something.


Re: Chose Team - arlindi - 11.02.2015

Yes I user ranodm but the random must choosen by TEAM_ZOMBIE


Re: Chose Team - arlindi - 12.02.2015

AnyOne?


Re: Chose Team - nezo2001 - 12.02.2015

Explain no one understand you !!!


Re: Chose Team - arlindi - 12.02.2015

I want to choose somebody random by ZOMBIE TEAM

UNderstand now ?/


Thank you


Re: Chose Team - PowerPC603 - 12.02.2015

Create an array, put all player-id's which are in the zombie-team in this array and count them.
Then you can use "random" to select a random index from that array with "count" as your maximum value.

pawn Код:
new Players[MAX_PLAYERS], Count;

for (new pid; pid < MAX_PLAYERS; pid++)
{
    if (GetPlayerTeam(pid) == TEAM_ZOMBIE)
    {
        Players[Count] = pid;
        Count++;
    }
}

new RandomZombiePlayer = Players[random(Count)];
Something like this should work.


Re: Chose Team - arlindi - 14.02.2015

I dont know his id's
I want
Its a Function StartMap
and in it i want to choose randomid by Team_Zombie


Re: Chose Team - Golf - 14.02.2015

PHP код:
        for(new 0MAX_PLAYERS i++)
        {
            if(
gTeam[i] == TEAM_ZOMBIE) {
            
//    script......
            
}
        } 



Re: Chose Team - arlindi - 14.02.2015

I want to chose any player from team zombie
Not set the playerid