Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSGO : sourceServer.getPlayers().size() always return 1 #247

Closed
danielsawan opened this issue Jun 4, 2014 · 12 comments
Closed

CSGO : sourceServer.getPlayers().size() always return 1 #247

danielsawan opened this issue Jun 4, 2014 · 12 comments

Comments

@danielsawan
Copy link

Evrything is in the title. When there is 0 player connected, GOTV off, sourceServer.getPlayers().size() always return 1.

Then, when i try sourceServer.getPlayers().get(0).getPlayerName() i got a nullpointer exception.

Any idea ?

@danielsawan
Copy link
Author

PS : JAVA Version of condenser

@danielsawan
Copy link
Author

1.3.7

@danielsawan
Copy link
Author

Didn't even try to get more player on the server to test. This method maybe doesn't work at all...

@koraktor
Copy link
Owner

koraktor commented Jun 4, 2014

Any server-side plugins? What's the player count in Steam's server browser or other tools?

@psychonic
Copy link
Contributor

As of a CS:GO update a few months ago, the players list output changed,
as did others.

  • Added convar host_name_store to indicate whether host name is revealed
    in queries and GOTV. Host name is always printed in status command output.
  • Added convar host_info_show, operators can set it to the following
    values: 0 to block server info queries; 1 (default) to respond with all
    details excluding identities; 2 to respond with all available details.
  • Added convar host_players_show, operators can set it to the following
    values: 0 to block server players queries; 1 (default) to respond only
    with max players and uptime; 2 to respond with all players details.

With the new default, it always returns a single "player" with the name
"Max Players", and the score is the max player count.

Set host_players_show to 2 to get the old behavior.

Nicholas Hastings

Sebastian Staudt mailto:notifications@github.com
Wednesday, June 4, 2014 7:25 AM

Any server-side plugins? What's the player count in Steam's server
browser or other tools?


Reply to this email directly or view it on GitHub
#247 (comment).

Daniel SAWAN mailto:notifications@github.com
Wednesday, June 4, 2014 2:14 AM

Evrything is in the title. When there is 0 player connected, GOTV off,
sourceServer.getPlayers().size() always return 1.

Then, when i try sourceServer.getPlayers().get(0).getPlayerName() i
got a nullpointer exception.

Any idea ?


Reply to this email directly or view it on GitHub
#247.

@koraktor
Copy link
Owner

koraktor commented Jun 4, 2014

@psychonic Do you know what the SteamPlayer object looks like for that dummy player? Has it any useful data?

@danielsawan Do you have one or more IPs of servers that show this behavior?

@danielsawan
Copy link
Author

Yes here is an IP : 62.210.177.75:29011
All others servers hosted are like that :/
I don't have any plugin simple default installation. I know i had no problem before so i guess it is a valve update. It is not since the last update it is for a long time now. I thought it is gonna be fixed but nothing happen that's why i decided to open this tickets.

The CS:go browser show 0 players connected but the condenser say 1.

@koraktor
Copy link
Owner

Ok, finally found the time to have a look at this.

Because Valve decided to abuse the protocol's S2A_PLAYER packet, there's no simple solution for this problem in Steam Condenser. The servers simply return a player named "Max Player", there's no way to determine if this is a real player or just the dummy to represent the maximum number of players.

The correct way would be to have a look at the host_players_show CVAR using GameServer#getRules() and after that decide what to do with the players returned (e.g. ignore "Max Players").

BTW, the right way to get the first player is not sourceServer.getPlayers().get(0) as #getPlayers() returns a Map. Instead you could use players.values().iterator().next() for testing, but real code should check the size first.

@danielsawan
Copy link
Author

Oh so can we say for example that real player always equals to getPlayers() minus 1 ?
And what if there is 3 players on the server ? Will getPlayers return a map of 3 or 4 ?

@koraktor
Copy link
Owner

The Map will always include the dummy player. Sadly, as said before, there's no way to reliably filter this player.

@danielsawan
Copy link
Author

Sorry but are you telling me that right now there is now way to get the number of connected player to a csgo server calling server.getPlayers() ?
Is there any other way ??

I can't imagine that it is just not possible anymore to get such a usefull information.

@danielsawan
Copy link
Author

Oh sorry i just understand the host_players_show 2 tricks. My bad. Thanks again ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants