I understand your request but couldn't understand the array you've provided ('Player[1][iTeam]'), so I suggest two different alternatives:
Team Array:
PHP Code:
#define TEAMS 8
new aTeams[ TEAMS ][ 4 ];
new aPlayers[ 32 ], iPnum, iCurrent, iIndex;
get_players( aPlayers, iPnum ); // get players on the server
SortIntegers( aPlayers, iPnum, Sort_Random ); // shuffle the players array
while( iPnum )
{
aTeams[ iCurrent ][ iIndex ] = aPlayers[ iPnum - 1 ]; // push a player to a team, one by one to each team
iPnum --;
if( ++iCurrent >= TEAMS )
{
iCurrent = 0;
iIndex ++;
}
}
/*
To use like this:
aTeams[ 0 ][ 0 ], first player in team A
aTeams[ 2 ][ 3 ], last player in team C
*/
Players Array:
PHP Code:
#define TEAMS 8
new aPlayerTeams[ 33 ];
new aPlayers[ 32 ], iPnum, iCurrent;
get_players( aPlayers, iPnum ); // get players on the server
SortIntegers( aPlayers, iPnum, Sort_Random ); // shuffle the players array
for( new i = 0; i < iPnum; i++ )
{
aPlayerTeams[ aPlayers[ i ] ] = iCurrent; // set player's team, one by one to each team
if( ++iCurrent >= TEAMS )
iCurrent = 0;
}
/*
To use like this:
aPlayerTeams[ 14 ] to get team of player 14, result will be between 0 and 7
*/
Also there's a chance that Sort_Random is only for AMXX 1.8.3/1.9 (I don't really remember), so if you have problems with that native tell me and i'll change it.