XServerQuery

Need some nice Mods? Here, you are right!
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Re: XServerQuery

Post by Buggie »

Code: Select all

//======================================================================================================
// BUGFIX for Nexgen servers... a local SendPlayers().
//======================================================================================================
function bool SendPlayers(IpAddr Addr, int queryNum, out int packetNum, int bFinalPacket) {
	local Pawn P;
	local bool bResult, bSendResult;
	local int i;

	if (Level.Game.NumPlayers <= 0) {
		return SendQueryPacket(Addr, "", queryNum, packetNum, bFinalPacket);
	}

	bResult = false;

	P = Level.PawnList;
	while (i < Level.Game.NumPlayers) {
		if (P.IsA('PlayerPawn')) {
			if (i == Level.Game.NumPlayers - 1 && bFinalPacket == 1) {
				bSendResult = SendQueryPacket(Addr, GetPlayer(PlayerPawn(P), i), queryNum, packetNum, 1);
			} else {
				bSendResult = SendQueryPacket(Addr, GetPlayer(PlayerPawn(P), i), queryNum, packetNum, 0);
			}
			bResult = bSendResult || bResult;
			i++;
		}
		P = P.NextPawn;
	}
	return bResult;
}
1. This code contains very doubtful loop.
If there be NumPlayers not zero and no any PlayerPawn, loop never end and server crash with runaway limit.
On condition need check "P != None".

2. This code report spectators as well. Which not match stock behavior:

Code: Select all

// Send data for each player
function bool SendPlayers(IpAddr Addr, int QueryNum, out int PacketNum, int bFinalPacket)
{
	local Pawn P;
	local int i;
	local bool Result, SendResult, SentFinalPacket;
	
	Result = false;
	SentFinalPacket = false;

    for ( P = Level.PawnList; P != none; P = P.nextPawn)
    {
		if (P.IsA('PlayerPawn') && !P.IsA('Spectator'))
		{
			if( i==Level.Game.NumPlayers-1 && bFinalPacket==1)
			{
				SendResult = SendQueryPacket(Addr, GetPlayer(PlayerPawn(P), i), QueryNum, PacketNum, 1);
				SentFinalPacket = true;
			}
			else
				SendResult = SendQueryPacket(Addr, GetPlayer(PlayerPawn(P), i), QueryNum, PacketNum, 0);
			Result = SendResult || Result;
			i++;
		}
	}

	// stijn: make sure we send the \final\ packet even if we didn't report all players
	if (bFinalPacket == 1 && !SentFinalPacket)
	    SendQueryPacket(Addr, "", QueryNum, PacketNum, 1);

	return Result;
}
if (P.IsA('PlayerPawn') && !P.IsA('Spectator'))

Finally, because of this loop there exists next bug:

1. Play 2 players. NumPlayers is 2. Report is ok.
2. Enter spectator.
3. NumPlayers is still 2, but spectator send as player. It is first, because new pawn get into head of Level.PawnList chain.
4. So on send will be send spectator (as player) and one from player. After that loop stop. And second player not send.

So finally we have spectator in output, and missed player.

Automatically merged

Code: Select all

function bool SendPlayers(IpAddr Addr, int queryNum, out int packetNum, int bFinalPacket) {
	local Pawn P;
	local bool bResult, bSendResult, bSentFinalPacket;
	local int i;

	if (Level.Game.NumPlayers <= 0) {
		return SendQueryPacket(Addr, "", queryNum, packetNum, bFinalPacket);
	}

	bResult = false;

	for ( P = Level.PawnList; P != none; P = P.nextPawn) {
		if (P.IsA('PlayerPawn') && !P.IsA('Spectator')) {
			if (i == Level.Game.NumPlayers - 1 && bFinalPacket == 1) {
				bSendResult = SendQueryPacket(Addr, GetPlayer(PlayerPawn(P), i), queryNum, packetNum, 1);
				bSentFinalPacket = true;
			} else {
				bSendResult = SendQueryPacket(Addr, GetPlayer(PlayerPawn(P), i), queryNum, packetNum, 0);
			}
			bResult = bSendResult || bResult;
			i++;
		}
	}
	
	// stijn: make sure we send the \final\ packet even if we didn't report all players
	if (bFinalPacket == 1 && !bSentFinalPacket)
	    SendQueryPacket(Addr, "", QueryNum, PacketNum, 1);
	
	return bResult;
}
I make this change and compile with v436 UnrealEd.

There fixed loop, stop report spectators, and integrate Anth fix for send final packet in all cases.
XServerQuery211_fix1.zip
(154.46 KiB) Downloaded 18 times

Automatically merged

Second fix

resultSet = resultSet$Chr(92)$"BotSkill"$Chr(92)$class'ChallengeBotInfo'.default.Skills[Level.Game.Difficulty];
to
resultSet = resultSet$Chr(92)$"BotSkill"$Chr(92)$class'ChallengeBotInfo'.default.Skills[DeathMatchPlus(Level.Game).BotConfig.Difficulty];

For fix discussed in topic bug.
XServerQuery211_fix2.zip
(154.49 KiB) Downloaded 26 times
Eternity
Skilled
Posts: 166
Joined: Sat Nov 30, 2019 10:56 pm

Re: XServerQuery

Post by Eternity »

1. One of the modifications of this mod has a configurable bool option for "SendPlayers" function that sends either Players only, or Players with Spectators together properly...
2. Should we make sure \final\ packet is sent in "SendXPlayers" function too?
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Re: XServerQuery

Post by Buggie »

1. Anyway regular pingers not expect spectators here and show then as players which is totally wrong.
For not regular pingers which use extends syntax you can use bShowSpectators, which is here. idk from start or no, but it here.

2. Yes. Should.

Automatically merged

I replace extended send with this:

Code: Select all

function bool SendXPlayers(IpAddr Addr, int queryNum, out int packetNum, int bFinalPacket) {
	local Pawn P;
	local bool bResult, bSendResult, bSentFinalPacket;
	local int i;

	if (numAllPlayers <= 0)
		return SendQueryPacket(Addr, "", queryNum, packetNum, bFinalPacket);

	bResult = false;

	for ( P = Level.PawnList; P != none; P = P.nextPawn) {
		if (P.IsA('PlayerPawn') && (bShowSpectators || (!bShowSpectators && !P.IsA('Spectator')))) {
			if (i >= numAllPlayers - 1 && bFinalPacket == 1) {
				bSendResult = SendQueryPacket(Addr, GetPlayerInfo(PlayerPawn(P), i), queryNum, packetNum, 1);
				bSentFinalPacket = true;
			} else {
				bSendResult = SendQueryPacket(Addr, GetPlayerInfo(PlayerPawn(P), i), queryNum, packetNum, 0);
			}
			bResult = bSendResult || bResult;
			i++;
		}
	}

	// stijn: make sure we send the \final\ packet even if we didn't report all players
	if (bFinalPacket == 1 && !bSentFinalPacket)
	    SendQueryPacket(Addr, "", QueryNum, PacketNum, 1);

	return bResult;
}
Fixed same awful loop.
And add Anth fix.
XServerQuery211_fix3.zip
(154.53 KiB) Downloaded 33 times
User avatar
Que
Inhuman
Posts: 781
Joined: Mon Dec 09, 2019 5:49 am
Personal rank: ...
Contact:

Re: XServerQuery

Post by Que »

could someone please add the function bHideBlackListed to the next version of XServerQuery ?

Image

Default = True (Ticked)

cheers.
*Join our Discord Here.*
Our mods - MVX , SSB , SmartWFL , UTCmds , BotCommands , Smart Stats , join/leave announcer , NoSmoke , UTLogin , BrightSkins , Server Tran…
*Our Servers
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: XServerQuery

Post by Barbie »

I recently joined a server running XServerQuery with the player name "😁" (unicode 1f601) and an UT client running XBrowser 2.0.1. Both GameTracker as well as UT client's XBrowser could not list the players - XBrowser marks the server as unreachable for a second but then shows server info, but no players. Then XBrowser restarts that cycle.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Eternity
Skilled
Posts: 166
Joined: Sat Nov 30, 2019 10:56 pm

Re: XServerQuery

Post by Eternity »

It is unlikely worth to handle/fix this case since invalid player name characters allowed by the server's login filters might already be a problem for a lot of other things running on the server. Also, full support of unicode player names is not going to happen...
Probably, it might be worth to include such filters into default login scripts in v469 patch... Until then, need to override "Login"/"ChangeName" functions to fix this problem...
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: XServerQuery

Post by Barbie »

I'm running two server with identical setup for [XServerQuery.UdpXServerQuery], but the display in client differs:
Here the homepage is missing:
Barbies world wrote: [XServerQuery.UdpXServerQuery]
homepage=https://forum.barbies.world/
bSendMailURL=true
BarbiesWorld.jpg
Here the homepage is displayed:
Barbies tank world wrote: [XServerQuery.XServerQuery]
homepage=https://forum.barbies.world/
bSendMailURL=true
BarbiesTankWorld.jpg
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
ruhin
Posts: 1
Joined: Mon Jun 13, 2022 12:30 pm
Personal rank: asket

Re: XServerQuery

Post by ruhin »

I don't understand why you use these scripts?
I will never play on a server that installs its own scripts.
And about "dll" generally I am silent!

Just don't say it's against cheaters, I don't believe you and not only me.

The Russian "asosed" (195.98.73.166:6666) has a script that steals data - everything is known!
I specifically installed the "CommView" program and looked at what kind of packets it sends.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: XServerQuery

Post by Barbie »

Are you talking to me? :omfg:
XServerQuery contains a DLL?
All pills taken today?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
papercoffee
Godlike
Posts: 10443
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: XServerQuery

Post by papercoffee »

ruhin wrote: Mon Jun 20, 2022 5:13 pm I don't understand why you use these scripts?
I will never play on a server that installs its own scripts.
And about "dll" generally I am silent!

Just don't say it's against cheaters, I don't believe you and not only me.

The Russian "asosed" (195.98.73.166:6666) has a script that steals data - everything is known!
I specifically installed the "CommView" program and looked at what kind of packets it sends.
:| Wut?

And what does it have to do with XServerQuery?
Please open an own thread ...and it would be nice to show evidence before accusing someone.
Out of the blue comes a first time poster and accuse a known server owner/admin a rather heavy misconduct ...this smells pretty much like a personal beef thing.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: XServerQuery

Post by Barbie »

Barbie wrote: Mon Jun 20, 2022 3:30 pm I'm running two server with identical setup for [XServerQuery.UdpXServerQuery], but the display in client differs
Does anyone know a simple method to require server infos so that I can verify the server settings? The script at wiki seems only work for the localhost. (For IP addresses of remote hosts it reports a timeout.)
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Re: XServerQuery

Post by Buggie »

Make ping.php file.
Put here:

Code: Select all

<?php
$addr = $argv[1];
$port = $argv[2] + 1;
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_sendto($s, $argv[3], strlen($argv[3]), 0, $addr, $port);
socket_recvfrom($s, $data, 65535, 0, $addr, $port);
echo $addr.':'.$port.PHP_EOL.PHP_EOL;
echo 'raw:'.PHP_EOL.$data.PHP_EOL.PHP_EOL;
$data = explode('\\', $data);
$data = implode('', array_map('parse', $data, array_keys($data)));
echo 'parsed:'.PHP_EOL.$data.PHP_EOL;
function parse($a, $b) {
	return $a.($b % 2 ? ' = ' : PHP_EOL);
}
use as:

Code: Select all

php ping.php 85.214.243.170 7777 \status\
get info

Code: Select all

85.214.243.170:7778

raw:
\gamename\ut\gamever\469\minnetver\432\location\0\hostname\Barbies Monsterhunt World\hostport\7777\maptitle\Detour\mapname\MH-DetourV2\gametype\MonsterHuntSB\numplayers\3\maxplayers\32\gamemode\openplaying\gamever\469\minnetver\432\worldlog\false\wantworldlog\false\mutators\SB Map Patcher Server v2643 , Map Vote Ultimate 1.2, SB Fast Redeemer Version 5, CoopTranslocator12, Translator for MonsterHunt v2, UserMute Mutator, GiftFromDecoration\listenserver\False\password\False\timelimit\0\goalteamscore\30\minplayers\0\changelevels\True\maxteams\4\balanceteams\False\playersbalanceteams\True\friendlyfire\20%\tournament\False\gamestyle\Hardcore\AdminName\Barbie\AdminEMail\SeriousBarbie@barbies.world\player_0\lactantius.nl\frags_0\2019\ping_0\ 35\team_0\0\mesh_0\Male Soldier\skin_0\Soldierskins.Blkt\face_0\Soldierskins.Othello\ngsecret_0\true\player_1\Wolfy\frags_1\31302\ping_1\ 56\team_1\0\mesh_1\Female Commando\skin_1\FCommandoSkins.goth\face_1\FCommandoSkins.Freylis\ngsecret_1\true\queryid\86.1

parsed:

gamename = ut
gamever = 469
minnetver = 432
location = 0
hostname = Barbies Monsterhunt World
hostport = 7777
maptitle = Detour
mapname = MH-DetourV2
gametype = MonsterHuntSB
numplayers = 3
maxplayers = 32
gamemode = openplaying
gamever = 469
minnetver = 432
worldlog = false
wantworldlog = false
mutators = SB Map Patcher Server v2643 , Map Vote Ultimate 1.2, SB Fast Redeemer Version 5, CoopTranslocator12, Translator for MonsterHunt v2, UserMute Mutator, GiftFromDecoration
listenserver = False
password = False
timelimit = 0
goalteamscore = 30
minplayers = 0
changelevels = True
maxteams = 4
balanceteams = False
playersbalanceteams = True
friendlyfire = 20%
tournament = False
gamestyle = Hardcore
AdminName = Barbie
AdminEMail = SeriousBarbie@barbies.world
player_0 = lactantius.nl
frags_0 = 2019
ping_0 =  35
team_0 = 0
mesh_0 = Male Soldier
skin_0 = Soldierskins.Blkt
face_0 = Soldierskins.Othello
ngsecret_0 = true
player_1 = Wolfy
frags_1 = 31302
ping_1 =  56
team_1 = 0
mesh_1 = Female Commando
skin_1 = FCommandoSkins.goth
face_1 = FCommandoSkins.Freylis
ngsecret_1 = true
queryid = 86.1
Another possible queries you can found at
https://wiki.beyondunreal.com/Legacy:UT_Server_Query
And in XServerQuery help files.
Wanna note only \teams\ command.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: XServerQuery

Post by Barbie »

Barbie wrote: Mon Jun 20, 2022 3:30 pm I'm running two server with identical setup for [XServerQuery.UdpXServerQuery], but the display in client differs:
Here the homepage is missing:
Barbies world wrote: [XServerQuery.UdpXServerQuery]
Here the homepage is displayed:
Barbies tank world wrote: [XServerQuery.XServerQuery]
I finally have found the reason: "UdpXServerQuery" vs. "XServerQuery". :facepalm:

Automatically merged

Buggie wrote: Sat Jun 25, 2022 7:10 pm Make ping.php file.
Thanks. It has helped me to solve the issue with missing display of homepage.
:gj:
NB: the syntax to get extended infos from XServerQuery is

Code: Select all

php ping.php 85.214.243.170 7777 \status\XServerQuery
(Double the escape char "\" on *nix systems.)
Buggie wrote: Sat Jun 25, 2022 7:10 pm Another possible queries you can found at
https://wiki.beyondunreal.com/Legacy:UT_Server_Query
As I wrote above, that script does not work for remote hosts.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Re: XServerQuery

Post by Buggie »

> As I wrote above, that script does not work for remote hosts.
As I wrote above, "Another possible queries you can found at". There no any single word about script. Only about possible queries. For example '\basic\ or \info\
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Re: XServerQuery

Post by Buggie »

Que wrote: Tue May 03, 2022 4:05 am could someone please add the function bHideBlackListed to the next version of XServerQuery ?

Image

Default = True (Ticked)

cheers.
Wrong topic. You need viewtopic.php?f=34&t=3284
Post Reply