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

bug: players array not always returning #632

Open
delboychad opened this issue Sep 10, 2024 · 3 comments
Open

bug: players array not always returning #632

delboychad opened this issue Sep 10, 2024 · 3 comments

Comments

@delboychad
Copy link

Describe the bug
The state.players array is currently returning Players(0) [] even when it further up it recognises there is 12 numplayers.

However there are occasions it works, its just mixing between the two.

Expected behavior
Should return the data array of players.

Screenshots or Data
let playerList;
if (state.players && state.players.length > 0) {
playerList = state.players.map(player => player.name || 'Unknown').join('\n'); // Add line breaks here
} else if (state.numplayers > 0) {
playerList = 'Player details unavailable';
} else {
playerList = 'No players online';
}

Console (from public server, used for test):
Results {
name: 'Gaminglight ▌ ImperialRP ▌ Custom ▌ No Training',
map: 'rp_anaxes_v2-5',
password: false,
raw: {
protocol: 17,
folder: 'garrysmod',
game: 'starwarsrp',
appId: 4000,
numbots: 0,
listentype: 'd',
environment: 'l',
secure: 1,
steamid: '85568392923361747',
tags: [ ' gm:starwarsrp loc:us ver:240809' ],
players: []
},
version: '2023.06.28',
maxplayers: 110,
numplayers: 12,
players: Players(0) [],
bots: Players(0) [],
queryPort: 27015,
connect: '193.243.190.36:27015',
ping: 19
}
Players(0) []

@delboychad delboychad added the bug label Sep 10, 2024
@CosminPerRam
Copy link
Member

CosminPerRam commented Sep 10, 2024

Garrys mod runs on the Valve protocol, which has players number in the 'general informations' query (this is why you see the players count but no players):

state.numplayers = reader.uint(1)

Although I see that on gametracker it does report some players, while making our query, the server does not respond to the players query which times out:

Q#0 Requesting player list ...
193.243.190.36:27015 UDP(49902)-->
Buffer length: 9 bytes
ff ff ff ff 55 ff ff ff ff 
            U              

193.243.190.36:27015 <--UDP(49902)
Buffer length: 9 bytes
ff ff ff ff 41 83 79 d9 bc 
            A     y        

Q#0 Registered RTT: 41ms
Q#0 Received full packet
Q#0 Received 0x41 expected 0x44
Q#0 Received new challenge key: 0xbcd97983
Q#0 UDP send finished by callback
193.243.190.36:27015 UDP(49902)-->
Buffer length: 9 bytes
ff ff ff ff 55 83 79 d9 bc 
            U     y        

Q#0 UDP timeout detected
Q#0 UDP timeout resolved by callback

(the logs show the initial query to which responds with a new challenge code, the final query is with the provided challenge, and it times out)

Although I queried the server a bunch of times, it always fails the players query, which is weird considering it works for you sometimes.
It is possible that it runs a plugin related to the query protocol (e.g. for protection, against stuff like DDOS) but I'll have to look into other servers to see if this is the case just for this server or more of a general problem.
Using RCON could provide us more info about players but we dont have it yet.

@CosminPerRam
Copy link
Member

Could you try to run the query with debug: true (or --debug for CLI) and post the logs here if a query responds with the players?

@CosminPerRam
Copy link
Member

Bump.

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

2 participants