|
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
|
10-09-2014
, 10:17
Re: Convert STEAMID to Steam Community ID
|
#338
|
Quote:
Originally Posted by Leonardo
I'll just leave it here.
PHP Code:
function ReadSteamID64( $SteamID64 )
{
if( !is_numeric( $SteamID64 ) ) return null;
$binary = str_pad( bcdecbin( $SteamID64 ), 64, '0', STR_PAD_LEFT );
return array(
'account' => bindec( substr( $binary, -32 ) ),
'instance' => bindec( substr( $binary, -52, 20 ) ),
'type' => bindec( substr( $binary, -56, 4 ) ),
'universe' => bindec( substr( $binary, -64, 8 ) )
);
}
|
I forget, has anyone mentioned in this thread yet that PHP's number type is only 32-bit on 32-bit systems? 'cause SteamID64 exceeds the size of a 32-bit int.
__________________
Not currently working on SourceMod plugin development.
|
|
|
|