lgsl icon indicating copy to clipboard operation
lgsl copied to clipboard

Request: Server query

Open TacTicTow opened this issue 2 years ago • 14 comments

I have tried usng the test.php but it basically just comfirms for me the server is online, which I already know. Not sure if I am doing something wrong.

Would like to see a query for RenegadeX game. I just dont seem to be able to get a response. This wiki shows the query parameters. Servers are using Unreal engine.

I also have several Call of Duty servers that I cant seem to get info from. The test.php shows they are online, but that is all I can get.

CoD Advanced Warfare CoD Ghosts CoD Modern Warfare 3 (included script does not work)

I can provide some IPs and ports if you need.

Black Ops, Black Ops 3 & Modern Warfare 2 are working great.

https://saltybawls.com/lgsl/userbar.php?s=14&t=2

https://saltybawls.com/lgsl/userbar.php?s=1&t=2

https://saltybawls.com/lgsl/userbar.php?s=5&t=2

These servers are made possible by https://plutonium.pw/ and https://xlabs.dev/

Lastly, do you have a patreon, paypal or similar account? I would like to donate some money to you. Your work on this script is awesome and youre the first to help me make this damn cron thing and charts work. Adding it to the banner was the last snippet I needed for my banners. :-) I would like to say thanks for your help.

TacTicTow avatar Feb 17 '22 23:02 TacTicTow

So I have finally got it to somewhat work. Using a Quake3 protocol 'lgsl_query_02' and added this line

elseif ($server['b']['type'] == "callofdutymw3")       { fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFgetinfo");       }

I do get a response showing it is online. The 'getinfo' seems to be what I need to get a response. I got a string of info from the server but no way to read it into an array to use for the LGSL output I need. Help?

https://saltybawls.com/lgsl/?s=24

PS: Found some more info on their forums, not sure how much it might help.

https://forum.plutonium.pw/topic/1354/server-query-data/9?_=1647322835529

TacTicTow avatar Mar 15 '22 06:03 TacTicTow

Here is the code from the games query. Using 'getinfo' and returning 'infoResponse'

https://github.com/XLabsProject/iw6x-client/blob/develop/src/client/component/party.cpp#L470

TacTicTow avatar Mar 15 '22 14:03 TacTicTow

Test script: https://saltybawls.com/bo1/test.php

TacTicTow avatar Mar 15 '22 15:03 TacTicTow

Wow did not think this was going to be so difficult a task. Seems there is no one on the entire internet able to create a working query protocol for this MW3. Even offering people money makes no difference.

Been taking an online PHP course to brush up on PHP. Might just write my own thing and abandon LGSL all together. No one seems to really support it anymore. Real damn shame. :-(

RIP

TacTicTow avatar Mar 26 '22 04:03 TacTicTow

Hello @TacTicTow

I was looked in links about MW3. Tried that way and also get nothing. Dunno why is it. But I found that MW3 works well using Black Ops 3 protocol!

Take a random server

image

And how it looks in LGSL

image

Note that query port is 27017

I'm sorry that I can't answer you earlier. LGSL not abandoned don't be so pessimistic :)

tltneon avatar Mar 26 '22 14:03 tltneon

I explained why that is. The query handshake used in Plutonium and XLabs is not the same. The original MW3, which is what is used on Gametracker, queries using the Source protocol. It uses this handshake...

fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFgetstatus");

Which is wrong and does not work. It needs to be sent the following:

fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFgetinfo");

And that will return the info form the server. Black Ops 1 uses the "getinfo" which is why it somewhat works. As I am studying PHP more I am starting to understand how this language works. This is what I have so far and what is needed to make a working protocol.

#1 - Send proper string to get response. (fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFgetinfo");) #2 - Retrieve info into array to be used with LGSL #3 - Use the Quake3 protocol to achieve this, Quake3 is the key

Now when I send this handshake the reply I get back is all in one single array key. It needs to be broken down so that each reposnse is in its own array key. This is what I currently get.

"Array ( [0] => ����infoResponse \protocol\20604\checksum-461731637\hostname[TDM] ALL MAPS\mapname\mp_bootleg\sv_maxclients\18\gametype\war\pure\1\con_disabled\1\kc\1\hw\6\mod\0\voice\2 )"

As you can see, the entire line is all in the array key index [0] instead of each item in its own key. Seems odd.

echo shows nothing, explode shows nothing, only way to get this response is with print_r

Here is a link to the C# game code itself so you can see how they are setting it up.

https://github.com/XLabsProject/iw6x-client/blob/develop/src/client/component/party.cpp#L470

I know these servers can be queried with all the info as I have gotten it to work with gamedig and gotten a proper response. I have not figured out how to just make PHP query using gamedig, beginning to think it is not possible. Should be simple enough to get the info I need from the created json file. But this seems like a lot of redundant work. I think LGSL should easily be able to do this. I just need to be able to break down the response from the server so that we can use that info in LGSL.

Take a look at thee links and info please. This is as far as I have gotten.

https://saltybawls.com/test/

Returns "Array ( [0] => ����infoResponse \protocol\20604\checksum-461731637\hostname[TDM] ALL MAPS\mapname\mp_bootleg\sv_maxclients\18\gametype\war\pure\1\con_disabled\1\kc\1\hw\6\mod\0\voice\2 )"

Code: <?php include('C:/Apache/htdocs/lgsl/lgsl_files/lgsl_class.php'); $result = lgsl_query_live('callofdutymw3', '64.74.97.92', 27025, 27025, 0, "s"); print_r($result);

I created a new gamedig protocol by copying quake3 protocal and editing 2 lines:

    this.sendHeader = 'getstatus';
    this.responseHeader = 'statusResponse';

changed to

    this.sendHeader = 'getinfo';
    this.responseHeader = 'infoResponse';

And with that I get the following when using the command:
gamedig --type "protocol-codmw3" --host "64.74.97.92" --port "27025"

{"name":"[TDM] ALL MAPS","map":"mp_village","password":false,"raw":{"protocol":"20604","checksum":"-461731637","hostname":"[TDM] ALL MAPS","mapname":"mp_village","sv_maxclients":"18","gametype":"war","pure":"1","con_disabled":"1","kc":"1","hw":"6","mod":"0","voice":"2\u0000"},"maxplayers":"18","players":[],"bots":[],"connect":"64.74.97.92:27025","ping":2}

So it is possible, just need to breakdown the response sent back from the query. I hope all this makes sense, still learning a lot myself. Also, I am not being pessimistic. Trying to get help with LGSL any more is almost impossible. Even the OGP forums are of little or no help. I have asked for help, have asked nicely, I have begged for help, have offered money for help and still after several months am unable to get a working protocol for MW3. It is frustratng because I know I am so close and dont have a lot of time needed to study and learn. I have already figured out quite a bit of it. All I need is to be able to break down the response so it can be used by LGSL. I already have the rest of it working.

Are you able to create a new working protocol based on the info I have given you so far? Please?

TacTicTow avatar Mar 27 '22 01:03 TacTicTow

You're right. Thanks for your doing. I know that I didn't respond so fast because of not enough of free time

I added Call of Duty IW protocol, can you test it?

tltneon avatar Mar 27 '22 02:03 tltneon

I have added it. Works! Thank you so very very much.

I really do appreciate what you did here. Looking back at it, it was such a simple thing, I was way over thinking this.

I do understand being busy. Not enough hours in the day. :-(

https://saltybawls.com/lgsl/?s=21

TacTicTow avatar Mar 27 '22 03:03 TacTicTow

I'm glad that it is important for you!

Also I can tell that I want to add one new experimental feature for LGSL soon. This feature can load pages faster.

tltneon avatar Mar 27 '22 06:03 tltneon

Ok so it works mostly. Does not seem to display players or player info. So it always shows zero players even when there are players on the server. Also does not display any server or player info. Odd.

TacTicTow avatar Mar 27 '22 08:03 TacTicTow

As I see server returns only basic server info, no player data.

tltneon avatar Mar 27 '22 14:03 tltneon

It does return some it seems. Player count but no names.

{"name":"[TDM] ALL MAPS","map":"mp_rust","password":false,"raw":{"protocol":"20604","checksum":"-461731637","hostname":"[TDM] ALL MAPS","mapname":"mp_rust","clients":"1","sv_maxclients":"18","gametype":"war","pure":"1","con_disabled":"1","kc":"1","hw":"6","mod":"0","voice":"2\u0000"},"maxplayers":"18","players":[],"bots":[],"connect":"64.74.97.92:27025","ping":2}

Uses 'clients' for the number of players connected. I fixed it with adding this line:

if (isset($server['e']['clients'])) { $server['s']['players'] = $server['e']['clients']; } // IW6, S1X, Ghost

I am disappinted it does not show player names.

TacTicTow avatar Mar 27 '22 16:03 TacTicTow

After looking at the C# code again for the server, it appears it may have the playername info but assigning it to "xuid" variable.

Not sure why these guys cant remain consistent and have to re-invent the wheel. Does this make sense?

` network::on("getInfo", [](const game::netadr_s& target, const std::string_view& data) { utils::info_string info{}; info.set("challenge", std::string{data}); info.set("gamename", "IW6"); info.set("hostname", get_dvar_string("sv_hostname")); info.set("gametype", get_dvar_string("g_gametype")); info.set("sv_motd", get_dvar_string("sv_motd")); info.set("xuid", utils::string::va("%llX", steam::SteamUser()->GetSteamID().bits)); info.set("mapname", get_dvar_string("mapname")); info.set("isPrivate", get_dvar_string("g_password").empty() ? "0" : "1"); info.set("clients", utils::string::va("%i", get_client_count())); info.set("bots", utils::string::va("%i", get_bot_count())); info.set("sv_maxclients", utils::string::va("%i", *game::mp::svs_numclients)); info.set("protocol", utils::string::va("%i", PROTOCOL)); //info.set("shortversion", SHORTVERSION); //info.set("hc", (Dvar::Var("g_hardcore").get() ? "1" : "0"));

			network::send(target, "infoResponse", info.build(), '\n');
		});`

TacTicTow avatar Mar 27 '22 17:03 TacTicTow

Works.

https://saltybawls.com/mw3/

Thank you!!

TacTicTow avatar Apr 04 '22 23:04 TacTicTow