Skip to content

Commit 7c8e5ad

Browse files
committed
Support challenges in A2S_INFO
1 parent fbabd44 commit 7c8e5ad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

SourceQuery/SourceQuery.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,18 @@ public function GetInfo( ) : array
202202

203203
$this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" );
204204
$Buffer = $this->Socket->Read( );
205-
206205
$Type = $Buffer->GetByte( );
207206
$Server = [];
208207

208+
if( $Type === self::S2A_CHALLENGE )
209+
{
210+
$this->Challenge = $Buffer->Get( 4 );
211+
212+
$this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" . $this->Challenge );
213+
$Buffer = $this->Socket->Read( );
214+
$Type = $Buffer->GetByte( );
215+
}
216+
209217
// Old GoldSource protocol, HLTV still uses it
210218
if( $Type === self::S2A_INFO_OLD && $this->Socket->Engine === self::GOLDSOURCE )
211219
{

0 commit comments

Comments
 (0)