|
|
Line 537: |
Line 537: |
|
| |
|
| == Examples == | | == Examples == |
|
| |
| === Basic segmented example ===
| |
|
| |
| In this example we query a simple co-operative server for some basic information.
| |
|
| |
| '''Request'''
| |
|
| |
| {| class="wikitable"
| |
| ! Type || Value || Description
| |
| |-
| |
| | Long || 199 || The launcher challenge.
| |
| |-
| |
| | Long || 1234 || Ping value.
| |
| |-
| |
| | Long || 36700161 || The flags we want: <tt><nowiki>SQF_NAME|SQF_PLAYERDATA|SQF_TEAMINFO_NUMBER|SQF_TESTING_SERVER</nowiki></tt>
| |
| |-
| |
| | Long || 6 || The extended flags we want: <tt><nowiki>SQF2_COUNTRY|SQF2_GAMEMODE_NAME</nowiki></tt>
| |
| |-
| |
| | Byte || 2 || Indicates we want a segmented response, if the server supports it.
| |
| |}
| |
|
| |
| '''Response'''
| |
| {| class="wikitable"
| |
| ! Type || Value || Description
| |
| |-
| |
| | Long || 5660032 || The server's response, indicating we're getting a segmented response packet.
| |
| |-
| |
| | Byte || 0 || The segment number.
| |
| |-
| |
| | Byte || 1 || Total number of segments.
| |
| |-
| |
| | Short || 0 || Offset of the packet.
| |
| |-
| |
| | Short || 747 || Size of this packet
| |
| |-
| |
| | Short || 747 || Total amount of data being sent.
| |
| |-
| |
| | colspan = 3 | Packet data follows after this point.
| |
| |-
| |
| | Long || 1234 || The ping value we sent to the server.
| |
| |-
| |
| | String || 3.2-alpha-r240718-2351 on Linux 6.9.9-1-default || The server's version.
| |
| |-
| |
| | Long || 35127297 || The fields contained in the response. <tt><nowiki>SQF_NAME|SQF_NUMPLAYERS|SQF_PLAYERDATA|SQF_TESTING_SERVER|SQF_EXTENDED_INFO</nowiki></tt>. Observe how:
| |
| * <tt>SQF_NUMPLAYERS</tt> was added by the server as we requested <tt>SQF_PLAYERDATA</tt>.
| |
| * <tt>SQF_EXTENDED_INFO</tt> was added indicating we'll get data from the extended flags.
| |
| * <tt>SQF_TEAMINFO_NUMBER</tt> was removed as this is a co-operative server and team information is irrelevant.
| |
| |-
| |
| | String || <tt>Skipper Pavilion</tt> || From <tt>SQF_NAME</tt>. The server's name.
| |
| |-
| |
| | Byte || 1 || From <tt>SQF_NUMPLAYERS</tt>. The number of players online.
| |
| |-
| |
| | String || <tt>Alphus</tt> || From <tt>SQF_PLAYERDATA</tt>. The name of the first player in the server.
| |
| |-
| |
| | Short || 0 || From <tt>SQF_PLAYERDATA</tt>. Alphus' score.
| |
| |-
| |
| | Short || 0 || From <tt>SQF_PLAYERDATA</tt>. Alphus' ping.
| |
| |-
| |
| | Byte || 0 || From <tt>SQF_PLAYERDATA</tt>. Whether Alphus is a spectator or not.
| |
| |-
| |
| | Byte || 1 || From <tt>SQF_PLAYERDATA</tt>. Whether Alphus is a bot or not.
| |
| |-
| |
| | Byte || 5 || From <tt>SQF_PLAYERDATA</tt>. How many minutes Alphus has been in the server.
| |
| |-
| |
| | Byte || 1 || From <tt>SQF_TESTING_SERVER</tt>. Whether the server is running a testing binary.
| |
| |-
| |
| | String || <tt>downloads/testing/3.2/ZandroDev3.2-230430-1741windows.zip</tt> || From <tt>SQF_TESTING_SERVER</tt>. Path to the testing binary on zandronum.com.
| |
| |-
| |
| | Long || 6 || From <tt>SQF_EXTENDED_INFO</tt>. The fields that follow from the extended flags: <tt><nowiki>SQF2_COUNTRY|SQF2_GAMEMODE_NAME</nowiki></tt>
| |
| |-
| |
| | char[3] || <tt>GBR</tt> || From <tt>SQF2_COUNTRY</tt>. The country code the server presents, as set by sv_country.
| |
| |-
| |
| | String|| <tt>Cooperative</tt> || From <tt>SQF2_GAMEMODE_NAME</tt>. The name of the game mode currently being played.
| |
| |}
| |
|
| |
|
| === Example code === | | === Example code === |