for( new i = 0; i < MAX_PLAYERS; i++ )
{
if( IsPlayerConnected( i ) && gTeam[ i ] = TEAM_X ) ShowPlayerDialog( ... );
// Change gTeam what whatever you're using for the Teams, and add the parameters in ShowPlayerDialog
// It will loop through the players, if they're connected and their team is TEAM_X, it will show them the dialog.
}