gamedig / node-gamedig

Query game servers and not only! Node.JS/Deno/Bun or Bash (via the CLI).
https://www.npmjs.com/package/gamedig
MIT License
608 stars 146 forks source link

unable to fetch player's list - 7 days to die #646

Open aman7 opened 1 month ago

aman7 commented 1 month ago

Describe the bug i am using gamedig for my discord bot to fetch player's list out of server, it is working with Unturned, but not with 7 days to die. instead of player's list it is sending Undefind. i have attached the screenshot.

Steps To Reproduce var totalPlayers = state.raw.numplayers; var names = "Total Number of player is (" + totalPlayers + ")\n\n"; players.forEach(element => { if (totalPlayers > 0) names += element.name + "\n"; }); console.log(names);

Expected behavior this should list all the existing players in the server.

Screenshots or Data gamedig

xCausxn commented 1 month ago

Hi @aman7,

looking at this code the players.forEach should be state.players.forEach basing it on your referenced code. Unless you are declaring this variable elsewhere as I cannot see from your snippet.

As for the player names, I do not believe these are visible anyway on the query as shown from the raw field while cross referencing with a random server on battlemetrics. https://www.battlemetrics.com/servers/7dtd/28162889

This is likely information only available over rcon.

CosminPerRam commented 1 month ago

Also the currently online players should be accessed through state.numplayers not from the raw field.

Could you post a Minimal Reproducible Example, the gamedig version you are using and if possible the server you are trying to query?

aman7 commented 1 month ago

Also the currently online players should be accessed through state.numplayers not from the raw field.

Could you post a Minimal Reproducible Example, the gamedig version you are using and if possible the server you are trying to query?

i am not trying to get number of players, i am trying to get list of players online.

CosminPerRam commented 1 month ago

Can you provide the server IP that you are trying to query and not get any players info?

aman7 commented 1 month ago

for example this server https://www.battlemetrics.com/servers/7dtd/29531220 Address 63.143.60.238:29800

xCausxn commented 1 month ago

@CosminPerRam Battlemetrics do not show a player list either, so I do not think the server exposes this information.

CosminPerRam commented 1 month ago
Server Query Output {"name":"SaltyZombies PVE US Casual","map":"Salty","password":false,"raw":{"protocol":17,"folder":"7DTD","game":"7 Days To Die","appId":251570,"numbots":0,"listentype":"d","environment":"l","secure":0,"steamid":"90202160542751766","tags":["ApoBAQMACAAAgOzmAhIYiAMFgAEEH7gBAgAAMrQHAAADAwOIA4gDpAGkAQcACC0AqNEDESEygKABQQrTAg=="],"players":[{"nam e":"","score":0,"time":4002.676025390625},{"name":"","score":0,"time":4000.481201171875},{"name":"","score":0,"time":4000.03076171875},{"name":"","score":0,"time":3985.624267578125},{"name":"","score":0,"time":3966.894287109375},{"name":"","score":0,"time":3962.34423828125},{"name":"","score":0,"time":3948.61572265625},{"name":"","score":0," time":3948.116943359375},{"name":"","score":0,"time":3939.6513671875},{"name":"","score":0,"time":3918.2138671875},{"name":"","score":0,"time":3913.76123046875},{"name":"","score":0,"time":3906.64697265625},{"name":"","score":0,"time":3869.72607421875},{"name":"","score":0,"time":3852.9931640625},{"name":"","score":0,"time":3845.081787109375 },{"name":"","score":0,"time":3830.485107421875},{"name":"","score":0,"time":3819.108642578125},{"name":"","score":0,"time":3808.710205078125},{"name":"","score":0,"time":3771.7197265625},{"name":"","score":0,"time":3730.080078125},{"name":"","score":0,"time":3678.33154296875},{"name":"","score":0,"time":3578.486572265625},{"name":"","score" :0,"time":3503.099609375},{"name":"","score":0,"time":3430.277587890625},{"name":"","score":0,"time":2911.47119140625},{"name":"","score":0,"time":2696.759765625},{"name":"","score":0,"time":2511.851318359375},{"name":"","score":0,"time":2475.716796875},{"name":"","score":0,"time":1825.9691162109375},{"name":"","score":0,"time":1692.01892089 84375},{"name":"","score":0,"time":1667.11669921875},{"name":"","score":0,"time":1613.21337890625},{"name":"","score":0,"time":1113.2679443359375},{"name":"","score":0,"time":319.02740478515625},{"name":"","score":0,"time":177.51206970214844}]},"version":"01.01.00","maxplayers":50,"numplayers":35,"players":[{"name":"","raw":{"score":0,"time" :4002.676025390625}},{"name":"","raw":{"score":0,"time":4000.481201171875}},{"name":"","raw":{"score":0,"time":4000.03076171875}},{"name":"","raw":{"score":0,"time":3985.624267578125}},{"name":"","raw":{"score":0,"time":3966.894287109375}},{"name":"","raw":{"score":0,"time":3962.34423828125}},{"name":"","raw":{"score":0,"time":3948.615722656 25}},{"name":"","raw":{"score":0,"time":3948.116943359375}},{"name":"","raw":{"score":0,"time":3939.6513671875}},{"name":"","raw":{"score":0,"time":3918.2138671875}},{"name":"","raw":{"score":0,"time":3913.76123046875}},{"name":"","raw":{"score":0,"time":3906.64697265625}},{"name":"","raw":{"score":0,"time":3869.72607421875}},{"name":"","raw ":{"score":0,"time":3852.9931640625}},{"name":"","raw":{"score":0,"time":3845.081787109375}},{"name":"","raw":{"score":0,"time":3830.485107421875}},{"name":"","raw":{"score":0,"time":3819.108642578125}},{"name":"","raw":{"score":0,"time":3808.710205078125}},{"name":"","raw":{"score":0,"time":3771.7197265625}},{"name":"","raw":{"score":0,"tim e":3730.080078125}},{"name":"","raw":{"score":0,"time":3678.33154296875}},{"name":"","raw":{"score":0,"time":3578.486572265625}},{"name":"","raw":{"score":0,"time":3503.099609375}},{"name":"","raw":{"score":0,"time":3430.277587890625}},{"name":"","raw":{"score":0,"time":2911.47119140625}},{"name":"","raw":{"score":0,"time":2696.759765625}},{ "name":"","raw":{"score":0,"time":2511.851318359375}},{"name":"","raw":{"score":0,"time":2475.716796875}},{"name":"","raw":{"score":0,"time":1825.9691162109375}},{"name":"","raw":{"score":0,"time":1692.0189208984375}},{"name":"","raw":{"score":0,"time":1667.11669921875}},{"name":"","raw":{"score":0,"time":1613.21337890625}},{"name":"","raw":{"score":0,"time":1113.2679443359375}},{"name":"","raw":{"score":0,"time":319.02740478515625}},{"name":"","raw":{"score":0,"time":177.51206970214844}}],"bots":[],"queryPort":29800,"connect":"63.143.60.238:29800","ping":145}

It provides players info, but not names, querying a bunch of other servers results in the same behaviour.

xCausxn commented 1 month ago

Yeah which is useless, other than maybe time connected. Probably why battlemetrics dont show it.

I would assume its an anti-stalking/streamer measure.