The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

XServerQuery

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 16:53, 14 December 2014 by (G)ott (Talk | contribs) (\info\xserverquery)

Jump to: navigation, search

Introduction

XServerQuery is a new Version of IpServer.UdpServerQuery.

The latest version is 1.2.0. // in some days ;)

It is a much-improved way of showing your server's current information. There are new headings like "Spectators" and "Protection Type" as well as the country of the current players.

There was some pointless commands removed and many new things added (see Query commands).

The Crash-Protection of SecureValidate is now working with XSQ. Thanks goes to JustDoIt.

How to Install?

1. Extract the XServerQuery.u file to your Server's System directory.

2. Stop your Server.

3. Open your Server's "UnrealTournament.ini" file and then locate this line in the ServerActors. When you do simply add a ';' at the front, so your line looks like this:

;ServerActors=IpServer.UdpServerQuery

- Maybe watch, that you dont have the following line (if so, remove it, or XSQ will not work correctly):

ServerActors=SecureValidate.SVUdpServerQuery

- You dont need to remove SecureValidate.SVUdpServerUplink if installed (XSQ dosnt support or use Uplink).


4. Now add the following new actor to your ServerActors list:

ServerActors=XServerQuery.UdpXServerQuery

5. If you want to use IpToCountry to show the current country of the players and server, then you need to install IpToCountry. If you already are running IpToCountry then you are fine.

6. Go to the next heading Settings before going to step 7.

7. Save your server's "UnrealTournament.ini" file and restart your Server as usual.

Settings

1. Add the following lines at the end of your "UnrealTournament.ini":

[XServerQuery.UdpXServerQuery]
NetAddress=
Homepage=www.example-hp.com
bSendMailURL=False
bShowProtection=True
bShowSpectators=True
bShowPlayerCountry=True
iMaxConnPerIPPerSec=1
iNumPacketsBeforLog=8
bLogSpecialQuerys=True
bLogUnknownQuerys=True

2. Change the settings as you want them.

NetAddress              // This is optional and will only needed if the server don't returns the real networkaddress for ITC.
                        // Server will auto set IP if found.
Homepage;               // Returns your homepage if set. Adding "http://" or "https://" in front of your page will enable the link function in XBrowser for it.
bSendMailURL;           // If True XSQ will send the admin e-mail with "mailto:" in front and will enable the link function in XBrowser for it.
bShowProtection;        // Valid values are "True", "Hidden" and something else mean "False".
bShowSpectators;        // Spectator informations will send, if your server allows spectators. False will hide specs on the player list.
bShowPlayerCountry;     // Allow sending the players country, if IPtoCountry is installed.
iMaxConnPerIPPerSec;    // (New since 1.11) Spam security. How many requests can a client send per second.
iNumPacketsBeforLog;    // (New since 1.11) Spam security. After how many requests the server will log this client. 0 is off.
bLogSpecialQuerys;      // Log query errors and 'secure' querys.
bLogUnknownQuerys;      // Log unknown querys.

Note: When you updating from a older version, delete (and backup before) the old settings!!

Query commands

\basic\

Same like here UT_Server_Query

\info\xserverquery

In this case you not only send a QueryType, you send a QueryValue too. Only "\info\" will return old infos.

That has to follow that, if the server uses XServerQuery, he sends you the new information, otherwise he'll give you back the old information.

So there should be no problems with the communication between "old" browsers and "newer" servers or vice versa.

Note: Some information was removed because they are either here not needed, or outdated and they are no longer in use.

\XServerQuery\XVersion
\Hostname\[Level.Game.GameReplicationInfo.ServerName]
\Hostport\[Level.Game.GetServerPort()]
\CountryS\[Country-Code if IpToCountry used] //optional
\NewNet\[NN Version eg.: "0.9"] //optional
\Protection\[returns "Hidden", "True" or eg.: "ACEv08h"] //optional
\Password\[string(Level.ConsoleCommand("get Engine.GameInfo GamePassword")!="")]
\NumPlayers\[Level.Game.NumPlayers]
\MaxPlayers\[Level.Game.MaxPlayers]
\GameType\[GetItemName(string(Level.Game.Class))]
\MapName\[Left(string(Level), InStr(string(Level), "."))]
\GameVer\[Level.EngineVersion]
\MinNetVer\[Level.MinNetVersion]

\rules\xserverquery

\AdminName\[Level.Game.GameReplicationInfo.AdminName]
\AdminEMail\[Level.Game.GameReplicationInfo.AdminEmail]
\Homepage\Homepage
\Spectators\[returns "Level.Game.NumSpectators/Level.Game.MaxSpectators", "False" or "Hidden"]
\NetMode\[returns "Dedicated Server" or "Listen Server"]
\GameStyle\[returns "Turbo", "Hardcore" or "Classic"]
\Tournament\[DeathMatchPlus(Level.Game).bTournament]
\TimeLimit\[DeathMatchPlus(Level.Game).TimeLimit]
\RemainingTime\[DeathMatchPlus(Level.Game).RemainingTime]

... if not TeamGame
\FragLimit\[DeathMatchPlus(Level.Game).FragLimit]
... else
\GoalTeamScore\[TeamGamePlus(Level.Game).GoalTeamScore]
\FriendlyFire\[TeamGamePlus(Level.Game).FriendlyFireScale]
\MaxTeams\[TeamGamePlus(Level.Game).MaxTeams]
\TeamName_#\[TeamGamePlus(Level.Game).Teams[#].TeamName]
\TeamScore_#\[TeamGamePlus(Level.Game).Teams[#].Score]
\TeamSize_#\[TeamGamePlus(Level.Game).Teams[#].Size]
... end if

\MapTitle\[Level.Title]
\MapAuthor\[Level.Author]
\IdealPlayerCount\[Level.IdealPlayerCount]

\MinPlayers\[DeathMatchPlus(Level.Game).MinPlayers]
\BotSkill\[class'ChallengeBotInfo'.default.Skills[Level.Game.Difficulty]]
\Mutators\[Level.Game.EnabledMutators]

\players\xserverquery

\Player_#\[P.PlayerReplicationInfo.PlayerName]
\CountryC_#\[players country-prefix or "none"]
\Ping_#\[P.ConsoleCommand("GETPING")]
\Time_#\[Play Time //FIXME:TimeSeconds are not accurate to real seconds.]
\Frags_#\[P.PlayerReplicationInfo.Score]
\Deaths_#\[P.PlayerReplicationInfo.Deaths]
\Health_#\[P.Health]
\Spree_#\[P.Spree]
\Team_#\[P.PlayerReplicationInfo.Team]
\Mesh_#\[P.Menuname]
\Skin_#\[SkinName]
\Face_#\[FaceName]

Note: The Players Time don't count like ingame and both are not accurate to real minutes.

I actually using this, maybe someone has a better solution:

// Epic has done this in Scoreboards:
	Time = Max(1, (Level.TimeSeconds + PlayerOwner.PlayerReplicationInfo.StartTime - PRI.StartTime)/60);
 
// if i use the same, it does not return the same Value. So i used this:
	GameSpeed = Level.Game.GameSpeed * 100;
	Seconds = (Level.TimeSeconds / GameSpeed) * 100;
	StartTime = (float(P.PlayerReplicationInfo.StartTime) / GameSpeed) * 100;
	TimeResult = Max(1, (Seconds - StartTime)/60);
 
	ResultSet = ResultSet$"\\Time_"$PlayerNum$"\\"$TimeResult;

\status\xserverquery

With QueryValue its something like: \info\xserverquery\rules\xserverquery\players\xserverquery

Only QueryType is like the old one: \basic\\info\\rules\\players\

\teams\

Its the same like in \rules\xserverquery, just separate to support the UT Watcher program. Thanks goes to El Muerte.

\team_#\[TeamGamePlus(Level.Game).Teams[#].TeamName]
\score_#\[TeamGamePlus(Level.Game).Teams[#].Score]
\size_#\[TeamGamePlus(Level.Game).Teams[#].Size]

\echo\

Same like here UT_Server_Query, but it returns only "\echo_replay\<your text>".

\level_property\, \game_property\ and \player_property\

This QueryType was removed, because of some secure things.