Server Query

Generic

The UDP protocol is used for server queries. Here's a PHP class to utilize the server query:

Query Types

Ping using value 0x00, or query using value 0x01.

Query Request Data

Header

Index Name Presence Data Byte Count Description
1 Identifier Required 0xFF 0xFF U G P 0x00 6 Identifier for server query protocol.
2 Version Required 0x01 1 Version of the server query protocol.
3 Request Type Required 0x00 or 0x01 1 Use 0x00 for ping, or use 0x01 for query.

Requested Information

This section is only included in the packet if Request Type is query.

Index Name Presence Data Byte Count Description
4 Request Flags Required See Table Below: Request Flags 1 Bit flags which specify the data to fetch.
5 Server Information Flags Required if Request Flags contains Server Information See Table Below: Server Information Flags 0 or 1 Bit flags which specify the server information data to fetch.
6 Player Information Flags Required if Request Flags contains Player Information See Table Below: Player Information Flags 0 or 1 Bit flags which specify the player information data to fetch.
7 Extra Player Information Flags Required if both:
  • Request Flags contains Player Information
  • Player Information Flags contains Extra Player Information Flags
See Table Below: Extra Player Information Flags 0 or 1 Bit flags which specify the extra player information data to fetch.
8 Team Information Flags Required if Request Flags contains Team Information See Table Below: Team Information Flags 0 or 1 Bit flags which specify the team information data to fetch.
9 Rule Information Flags Required if Request Flags contains Rule Information 0 or 1 Bit flags which specify the rule information data to fetch.

Query Response Data

Query Flags

Request Flags

Name Value Description
Server Information 0x01 Fetches generic information about the server.
Player Information 0x02 Fetches player information for connected players.
Team Information 0x04 Fetches team information for active teams.
Rule Information 0x08 Fetches the rules.

Server Information Flags

Name Value Description
Game Name 0x01 Fetches the game name text.
Extra Flags 0x02 Specifies that Extra Server Information Query Flags are used.
Server Name 0x04 Fetches the server name text.
Server Mode 0x08 Fetches the server mode text.
Server Map 0x10 Fetches the server map type.
Current Player Count 0x20 Fetches the current player count.
Max Player Count 0x40 Fetches the max player count.

Extra Server Information Flags

Name Value Description
Passworded 0x01 Fetches the server passworded state.
Version 0x02 Fetches the server version text.
OS 0x04 Fetches the server OS name text.

Player Information Flags

Name Value Description
ID 0x01 Fetches the ID for the player.
Name 0x02 Fetches the name for the player.
Team 0x04 Fetches the team for the player.
Score 0x08 Fetches the score for the player.
Kills 0x10 Fetches the kill count for the player.
Deaths 0x20 Fetches the death count for the player.
Extra Player Information Flags 0x40 Specifies that extra information about the player is present.

Extra Player Information Flags

Name Value Description
Ping 0x01 Fetches the ping for the player.
Time Joined 0x02 Fetches the time that the player joined.
Position 0x04 Fetches the 3D position for the player.
Health 0x08 Fetches the health amount for the player.
Armour 0x10 Fetches the armour amount for the player.
Skin 0x20 Fetches the skin model ID for the player.

Team Information Flags

Name Value Description
Name 0x01 Fetches the name of the team.
Score 0x02 Fetches the score for the team.
Player Count 0x04 Fetches the player count in the team.
Colour 0x08 Fetches the colour for the team.