pawn Код:
new Random = Iter_Random(Player);
Doesn't this gives you warnings? You aren't using it then why declare it?
pawn Код:
if(count == Iter_Count(Player))
This isn't required if all the players are TEAM_RED. You must use a specific integer value to check that limit. For example:
pawn Код:
if(count > Iter_Count(Player))
This will run only when there are more than 2 red team players.
I assume you want to pickup random players for choosing them, so this code will pick 2 random players from TEAM_RED:
pawn Код:
new players = Itter_Count(Player);
if(players > 1)//if there is more than 1 player
{
#define count 2//number of players we want to select
for(new x = 0; x < count; x++)//looping as many people we want to select
{
new bool:choosen = false;
foreach(new i : Player)//not an efficient method though! (but can work OK!)
{
new randomplayer = Iter_Random(Player);
if(team[randomplayer] == TEAM_RED)
{
//your code
SendClientMessage(randomplayer,COLOR_RED"You got chosen.");
choosen = true;
break;
}
}
if(! choosen)//in case no one was choosen, we will go loop sequently!
{
foreach(new i : Player)
{
if(team[i] == TEAM_RED)
{
//your code
SendClientMessage(i,COLOR_RED"You got chosen.");
break;
}
}
}
}
}