View Single Post
Author Message
voogru
Inspector Javert
Join Date: Oct 2004
Old 09-16-2007 , 00:09   Convert STEAMID to Steam Community ID
Reply With Quote #1

I figured I would share this little snippet, this will convert a STEAMID to the a players friendID which is used for steam community.

What could potentially be done with this, is to fetch data on a player, see what groups he is in, and basically gives you the flexibility to ban whole groups from your server without knowing all of their steamids.

At least, thats what I intend to do with it. You can also of course do the reverse, converting friend ID's to steamids.

PHP Code:
__int64 GetFriendID( const char *pszAuthID )
{
    if(!
pszAuthID)
        return 
0;

    
int iServer 0;
    
int iAuthID 0;

    
char szAuthID[64];
    
strcpy_s(szAuthID63pszAuthID);

    
char *szTmp strtok(szAuthID":");
    while(
szTmp strtok(NULL":"))
    {
        
char *szTmp2 strtok(NULL":");
        if(
szTmp2)
        {
            
iServer atoi(szTmp);
            
iAuthID atoi(szTmp2);
        }
    }

    if(
iAuthID == 0)
        return 
0;

    
__int64 i64friendID = (__int64)iAuthID 2;

    
//Friend ID's with even numbers are the 0 auth server.
    //Friend ID's with odd numbers are the 1 auth server.
    
i64friendID += 76561197960265728 iServer

    return 
i64friendID;

Have fun.

Edit: Using this a Pure MySQL was created

Last edited by devicenull; 02-22-2009 at 21:43.
voogru is offline