Raised This Month: $51 Target: $400
 12% 

Convert STEAMID to Steam Community ID


Post New Thread Reply   
 
Thread Tools Display Modes
Rizla
SourceMod Donor
Join Date: Jun 2010
Old 11-01-2010 , 16:06   Re: Convert STEAMID to Steam Community ID
Reply With Quote #271

Admin display:

http://forums.alliedmods.net/showthread.php?t=142123
Rizla is offline
jimbodude
Member
Join Date: Mar 2009
Location: England
Old 11-13-2010 , 16:33   Re: Convert STEAMID to Steam Community ID
Reply With Quote #272

How could I invert this c# code to do the opposite?
Code:
private string GetFriendID(string authid) 
        { 
            authid.Replace("STEAM_", ""); 
            string[] split = authid.Split(':'); 
            return "765611979" + ((Convert.ToInt64(split[2]) * 2) + 60265728 + Convert.ToInt64(split[1])).ToString(); 
        }

EDIT: After testing that above code, I have found that it does not work for some SteamID's.

Does anyone have a pair of c# functions to do the trick?
__________________

Last edited by jimbodude; 04-27-2011 at 10:09.
jimbodude is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 02-01-2011 , 09:03   Re: Convert STEAMID to Steam Community ID
Reply With Quote #273

For anyone interested, here is a C++ function I'm currently using.
PHP Code:
CSteamID atocsteamid(const char *pRenderedID) {
    
char renderedID[32];
    
V_strcpy(renderedIDpRenderedID);

    
char *strPrefix strtok(renderedID":");
    
char *strParity strtok(NULL":");
    
char *strHalfAccount strtok(NULL":");

    if (
strPrefix == NULL || strParity == NULL || strHalfAccount == NULL)
        return 
k_steamIDNil;

    if (
V_strlen(strPrefix) > || V_strncmp(strPrefix"STEAM_"6) != 0)
        return 
k_steamIDNil;

    
int parity atoi(strParity);
    if (
parity != && parity != 1)
        return 
k_steamIDNil;

    
long halfAccount atol(strHalfAccount);
    if (
halfAccount || halfAccount == LONG_MAX)
        return 
k_steamIDNil;

    
uint32 account = ((halfAccount << 1) | parity);

    return 
CSteamID(accountk_EUniversePublick_EAccountTypeIndividual);

Uses the Open Steamworks CSteamID class.
Designed to be accurate rather that fast, as thats what I needed.
__________________
asherkin is offline
Sunshine live
Veteran Member
Join Date: May 2009
Location: Berlin
Old 02-22-2011 , 19:23   Re: Convert STEAMID to Steam Community ID
Reply With Quote #274

Quote:
Originally Posted by 8088 View Post
I've received some requests to share the code I used to create this page, so I've attached a complete, working page below. It's nothing more than a compilation of what has been said/shared before in this thread.
hay, I have a fault and that if I use the register and there was nothing he convertiert. The errors can see her here

http://beta.warriorofheaven.de/index.php?steamid2

Excuse my bad english
__________________
Sunshine live is offline
Send a message via ICQ to Sunshine live Send a message via MSN to Sunshine live Send a message via Skype™ to Sunshine live
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 02-23-2011 , 02:31   Re: Convert STEAMID to Steam Community ID
Reply With Quote #275

http://beta.warriorofheaven.de/index.php?steamid2&s=
something wrong?
also
line 9
Code:
<form method="get" action="">
it should be like
Code:
<form method="get" action="/index.php?steamid2">
otherwise pressing button is redirecting to main page
__________________

Last edited by Leonardo; 03-24-2011 at 00:49.
Leonardo is offline
Bonx
New Member
Join Date: May 2011
Old 05-07-2011 , 05:12   Re: Convert STEAMID to Steam Community ID
Reply With Quote #276

Hey, iam a noob in PHP.
How you i get the avatar image resized like here? http://steamsig.net/load/4dc28893dbff0511600689.png

In the steam profile there are only small, middle and large. But this is a diffrent size.

Can any1 explain please ?
Bonx is offline
8088
Veteran Member
Join Date: Jan 2008
Old 05-07-2011 , 06:46   Re: Convert STEAMID to Steam Community ID
Reply With Quote #277

http://net.tutsplus.com/tutorials/ph...easy-with-php/
__________________
steamID converter with OpenSearch browser plugin
8088 is offline
Bonx
New Member
Join Date: May 2011
Old 05-07-2011 , 07:04   Re: Convert STEAMID to Steam Community ID
Reply With Quote #278

Now I have it like this
http://bonxx.ofree.de/steam/image%20resize.php

But its really pixelated.

My Code:
PHP Code:
<?php
// File and new size
$filename 'http://media.steampowered.com/steamcommunity/public/images/avatars/f1/f158a969a5c0dfe08183eac5a411490faf079b1e_full.jpg';
//$percent = 0.5;

// Content type
header('Content-Type: image/jpeg');

// Get new sizes
list($width$height) = getimagesize($filename);
//$newwidth = $width * $percent;
//$newheight = $height * $percent;

// Load
$thumb imagecreatetruecolor(107107);
$source imagecreatefromjpeg($filename);

// Resize
imagecopyresized($thumb$source0000107107$width$height);

// Output
imagejpeg($thumb);
?>
Bonx is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 05-07-2011 , 08:22   Re: Convert STEAMID to Steam Community ID
Reply With Quote #279

PHP Code:
function imageresize($outfile,$infile,$neww,$newh,$quality)
{
    
$im1=imagecreatefromjpeg($infile);
    
$k1=$neww/imagesx($im1);
    
$k2=$newh/imagesy($im1);
    
$k=$k1>$k2?$k2:$k1;

    
$w=intval(imagesx($im1)*$k);
    
$h=intval(imagesy($im1)*$k);

    
$im1=imagecreatetruecolor($w,$h);
    
imagecopyresampled($im2,$im1,0,0,0,0,$w,$h,imagesx($im1),imagesy($im1));

    
imagejpeg($im2,$outfile,$quality);
    
imagedestroy($im1);
    
imagedestroy($im2);
}

//example:
imageresize("""newimage.jpg"64024075); 
(c) http://www.codenet.ru/webmast/php/gd/Resize.php

Last edited by Leonardo; 05-07-2011 at 10:24.
Leonardo is offline
serpent
New Member
Join Date: Nov 2010
Old 05-09-2011 , 14:50   Re: Convert STEAMID to Steam Community ID
Reply With Quote #280

Would it be to much to share full .php with those functions to get avatar etc?
serpent is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode