Raised This Month: $51 Target: $400
 12% 

[CSGO]which make the player slot for spec?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rsdtt
Senior Member
Join Date: Oct 2009
Old 11-13-2019 , 03:28   [CSGO]which make the player slot for spec?
Reply With Quote #1

According to the order of connect server?
or server can setting A player is ct 4, B player is t 7?
__________________
I am learning sm now
rsdtt is offline
rsdtt
Senior Member
Join Date: Oct 2009
Old 11-13-2019 , 03:47   Re: [CSGO]which make the player slot for spec?
Reply With Quote #2

was that according to cl_color?
__________________
I am learning sm now
rsdtt is offline
Balimbanana
Member
Join Date: Jan 2017
Old 11-13-2019 , 13:54   Re: [CSGO]which make the player slot for spec?
Reply With Quote #3

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.
			}
		}
	}
}
Balimbanana is offline
rsdtt
Senior Member
Join Date: Oct 2009
Old 11-16-2019 , 23:35   Re: [CSGO]which make the player slot for spec?
Reply With Quote #4

Quote:
Originally Posted by Balimbanana View Post
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.
			}
		}
	}
}
sorry for my bad English.
I have a lan game need to bind the slot for player's camera.
just like your describe, clientid cant chose by us.
__________________
I am learning sm now
rsdtt is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode