procedure Get_A2S_INFO;
var
request: TInfoRequest;
response: TInfoResponse;
buffer: TBufferArray;
i: Integer;
CheckTime: TDateTime;
begin
request.RequestHeader := -1;
request.PacketHeader := '
T';
request.Payload := '
Source Engine Query';
// Von mir aus auch mit einer Konstante oder einem Ressourcestring
request.Payload[19] := #0;
form4.udp1.BlockMode := bmNonBlocking;
form4.udp1.RemoteHost:= form4.edit1.Text;
form4.udp1.RemotePort:= form4.edit2.Text;
form4.udp1.Open;
if form4.udp1.Connected
then
begin
form4.Udp1.SendBuf(request, SizeOf(TInfoRequest));
form4.udp1.WaitForData(250);
form4.Udp1.ReceiveBuf(buffer, SizeOf(buffer));
i := 0;
Move(buffer[i], response.ResponseHeader, SizeOf(response.ResponseHeader)); inc(i, SizeOf(response.ResponseHeader));
Move(buffer[i], response.PacketHeader, SizeOf(response.PacketHeader)); inc(i, SizeOf(response.PacketHeader));
Move(buffer[i], response.Protocol, SizeOf(response.Protocol)); inc(i, SizeOf(response.Protocol));
if response.ResponseHeader = -1
then
begin
response.
Name := GetString(buffer, i);
response.Map := GetString(buffer, i);
response.Folder := GetString(buffer, i);
response.Game := GetString(buffer, i);
Move(buffer[i], response.ID, SizeOf(response.ID)); inc(i, SizeOf(response.ID));
Move(buffer[i], response.Players, SizeOf(response.Players)); inc(i, SizeOf(response.Players));
Move(buffer[i], response.MaxPlayers, SizeOf(response.MaxPlayers)); inc(i, SizeOf(response.MaxPlayers));
Move(buffer[i], response.Bots, SizeOf(response.Bots)); inc(i, SizeOf(response.Bots));
Move(buffer[i], response.ServerType, SizeOf(response.ServerType)); inc(i, SizeOf(response.ServerType));
Move(buffer[i], response.Environment, SizeOf(response.Environment)); inc(i, SizeOf(response.Environment));
Move(buffer[i], response.Visibility, SizeOf(response.Visibility)); inc(i, SizeOf(response.Visibility));
Move(buffer[i], response.VAC, SizeOf(response.VAC)); inc(i, SizeOf(response.VAC));
response.Version := GetString(buffer, i);
Move(buffer[i], response.EDF, SizeOf(response.EDF)); inc(i, SizeOf(response.EDF));
Move(buffer[i], response.EDFPort, SizeOf(response.EDFPort)); inc(i, SizeOf(response.EDFPort));
Move(buffer[i], response.EDFSteamID, SizeOf(response.EDFSteamID)); inc(i, SizeOf(response.EDFSteamID));
Move(buffer[i], response.EDFSpecPort, SizeOf(response.EDFSpecPort)); inc(i, SizeOf(response.EDFSpecPort));
//response.EDFSpecName := GetString(buffer, i);
response.EDFKeywords := GetString(buffer, i);
Move(buffer[i], response.EDFGameID, SizeOf(response.EDFGameID)); inc(i, SizeOf(response.EDFGameID));
form4.lblServerHeader.Caption := chr(response.PacketHeader);
form4.lblServerProtocol.Caption := IntToStr(response.Protocol);
form4.lblServerName.Caption := response.
Name;
form4.lblServerMap.Caption := response.Map;
form4.lblServerFolder.Caption := response.Folder;
form4.lblServerGame.Caption := response.Game;
form4.lblServerID.Caption := inttostr(response.ID);
form4.lblServerPlayers.Caption := IntToStr(response.Players);
form4.lblServerMaxPlayers.Caption := IntToStr(response.MaxPlayers);
form4.lblServerBots.Caption := IntToStr(response.Bots);
form4.lblServerType.Caption := chr(response.ServerType);
form4.lblServerEnvironment.Caption := chr(response.Environment);
form4.lblServerVisibility.Caption := inttostr(response.Visibility);
form4.lblServerVAC.Caption := IntToStr(response.VAC);
form4.lblServerVersion.Caption := response.Version;
end
else
form4.lblServerName.Caption := '
Server nicht erreichbar';
end;
end;