Not fastest, though.
The use of flags slow down the function, a lot. The fastest way would be looping through 1 and get_maxplayers() checking if the user is alive and if the user is in that team. Calling an extra function (get_players in this case) will copy the IDs of the players to your array, and will very likely do the very same checks than my method.