From 7c8e5add773cd038384da96dc82f60038366bc1b Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Fri, 4 Dec 2020 10:18:46 +0200 Subject: [PATCH] Support challenges in A2S_INFO --- SourceQuery/SourceQuery.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SourceQuery/SourceQuery.php b/SourceQuery/SourceQuery.php index ecc9757..7100366 100644 --- a/SourceQuery/SourceQuery.php +++ b/SourceQuery/SourceQuery.php @@ -202,10 +202,18 @@ $this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" ); $Buffer = $this->Socket->Read( ); - $Type = $Buffer->GetByte( ); $Server = []; + if( $Type === self::S2A_CHALLENGE ) + { + $this->Challenge = $Buffer->Get( 4 ); + + $this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" . $this->Challenge ); + $Buffer = $this->Socket->Read( ); + $Type = $Buffer->GetByte( ); + } + // Old GoldSource protocol, HLTV still uses it if( $Type === self::S2A_INFO_OLD && $this->Socket->Engine === self::GOLDSOURCE ) {