|
|
@ -122,7 +122,7 @@
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Opens connection to server
|
|
|
|
* Opens connection to server
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param string $Ip Server ip
|
|
|
|
* @param string $Address Server ip
|
|
|
|
* @param int $Port Server port
|
|
|
|
* @param int $Port Server port
|
|
|
|
* @param int $Timeout Timeout period
|
|
|
|
* @param int $Timeout Timeout period
|
|
|
|
* @param int $Engine Engine the server runs on (goldsource, source)
|
|
|
|
* @param int $Engine Engine the server runs on (goldsource, source)
|
|
|
@ -130,7 +130,7 @@
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
* @throws SocketException
|
|
|
|
* @throws SocketException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function Connect( $Ip, $Port, $Timeout = 3, $Engine = self::SOURCE )
|
|
|
|
public function Connect( $Address, $Port, $Timeout = 3, $Engine = self::SOURCE )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->Disconnect( );
|
|
|
|
$this->Disconnect( );
|
|
|
|
|
|
|
|
|
|
|
@ -139,7 +139,7 @@
|
|
|
|
throw new InvalidArgumentException( 'Timeout must be an integer.', InvalidArgumentException::TIMEOUT_NOT_INTEGER );
|
|
|
|
throw new InvalidArgumentException( 'Timeout must be an integer.', InvalidArgumentException::TIMEOUT_NOT_INTEGER );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->Socket->Open( $Ip, (int)$Port, $Timeout, (int)$Engine );
|
|
|
|
$this->Socket->Open( $Address, (int)$Port, $Timeout, (int)$Engine );
|
|
|
|
|
|
|
|
|
|
|
|
$this->Connected = true;
|
|
|
|
$this->Connected = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -309,18 +309,17 @@
|
|
|
|
// You can use https://github.com/xPaw/SteamID.php
|
|
|
|
// You can use https://github.com/xPaw/SteamID.php
|
|
|
|
if( $Flags & 0x10 )
|
|
|
|
if( $Flags & 0x10 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$a = $Buffer->GetUnsignedLong( );
|
|
|
|
$SteamIDLower = $Buffer->GetUnsignedLong( );
|
|
|
|
$b = $Buffer->GetUnsignedLong( );
|
|
|
|
$SteamIDInstance = $Buffer->GetUnsignedLong( ); // This gets shifted by 32 bits, which should be steamid instance
|
|
|
|
$SteamID = 0;
|
|
|
|
$SteamID = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if( PHP_INT_SIZE === 4 )
|
|
|
|
if( PHP_INT_SIZE === 4 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( extension_loaded( 'gmp' ) )
|
|
|
|
if( extension_loaded( 'gmp' ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$a = gmp_abs( $a );
|
|
|
|
$SteamIDLower = gmp_abs( $SteamIDLower );
|
|
|
|
$b = gmp_abs( $b );
|
|
|
|
$SteamIDInstance = gmp_abs( $SteamIDInstance );
|
|
|
|
|
|
|
|
$SteamID = gmp_strval( gmp_or( $SteamIDLower, gmp_mul( $SteamIDInstance, gmp_pow( 2, 32 ) ) ) );
|
|
|
|
$SteamID = gmp_strval( gmp_or( $a, gmp_mul( $b, gmp_pow( 2, 32 ) ) ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -329,12 +328,12 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$SteamID = $a | ( $b << 32 );
|
|
|
|
$SteamID = $SteamIDLower | ( $SteamIDInstance << 32 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$Server[ 'SteamID' ] = $SteamID;
|
|
|
|
$Server[ 'SteamID' ] = $SteamID;
|
|
|
|
|
|
|
|
|
|
|
|
unset( $a, $b, $SteamID );
|
|
|
|
unset( $SteamIDLower, $SteamIDInstance, $SteamID );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The spectator port and then the spectator server name
|
|
|
|
// The spectator port and then the spectator server name
|
|
|
|