I don't quite understand the question.
If you mean what client ID is assigned to spectators. Client IDs are assigned incrementally from 1 regardless of what team they are on unless they are replacing an empty ID.
First player joins T ID 1
Second player joins CT ID 2
Third player joins spec ID 3
Fourth player joins T ID 4
First player leaves all IDs stay the same.
Fifth player joins spec ID 1 to replace empty slot 1
A way to check if a player is a spectator could be through this:
Code:
bool IsClientObserver(int client)
The way the ID system works, you would have to use a for loop to check through all players.
Something that a lot of people try is using a loop that uses GetClientCount. This will not work, as that specifically gives the amount of players on the server at the time, but does not correspond to IDs.
Code:
for (int i = 1;i<MaxClients+1;i++)
{
if (IsValidEntity(i))
{
if (IsClientConnected(i))
{
if (IsClientInGame(i))
{
//Here is where you could have checks for observer or if player is alive.
}
}
}
}