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

Convert STEAMID to Steam Community ID


Post New Thread Reply   
 
Thread Tools Display Modes
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 03-15-2009 , 22:34   Re: Convert STEAMID to Steam Community ID
Reply With Quote #151

Sure: http://steamcommunity.com/profiles/76561197984364389
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
siosios
SourceMod Donor
Join Date: Jan 2008
Old 03-16-2009 , 02:26   Re: Convert STEAMID to Steam Community ID
Reply With Quote #152

Quote:
Originally Posted by LANrat View Post
This thread lost me...but interest me.

I have this guy that comes into my server before i banned him and would try to crash it all the time.

any way someone can tell me the steam page for this steamid?

STEAM_0:1:12049330
if the information in this thread is a little over your head then your welcome to use the steamID plugin on my website (thanks to 8088 and the others): http://www.n00bunlimited.net/index.php?pageid=steam

sio
__________________
siosios is offline
lake393
AlliedModders Donor
Join Date: Oct 2008
Old 03-17-2009 , 22:43   Re: Convert STEAMID to Steam Community ID
Reply With Quote #153

Hi all, thanks to everyone. I made a VB.NET version.

The code converts both ways. It has format checking and will return 0 if the format is incorrect.

VB.NET
Code:
Imports System.Text

Public Class Form1

    Private Shared intBigNum As Long = 76561197960265728

    Private Function GetCommunityId(ByVal pSteamId As String) As String

        'Correct input param
        pSteamId = Trim(pSteamId)
        pSteamId = UCase(pSteamId)

        'Use RegEx (regular expression engine) to validate format
        Dim strRegEx As String = "\bSTEAM_[0-1]:[0-1]:(\d+)\b"
        If RegularExpressions.Regex.IsMatch(pSteamId, strRegEx) Then

            'Remove the "STEAM_" at the front
            pSteamId = pSteamId.Substring(6)

            'Split the string into parts
            Dim arrParts() As String = pSteamId.Split(":")
            Dim intAuthSvr1 As Integer = arrParts(0) 'This is usually always 0 for most Steam games except for L4D it's 1
            Dim intAuthSvr2 As Integer = arrParts(1)
            Dim intClientNum As Long = arrParts(2)

            'Do conversion
            Return CType(intBigNum + intAuthSvr2 + (intClientNum * 2), String)
        Else
            Return CStr(0)
        End If
    End Function

    Private Function GetSteamId(ByVal pCommunityId As String) As String
        If pCommunityId.Length = 17 And IsNumeric(pCommunityId) = True Then
            Dim intCommunityId As Long = CType(pCommunityId, Long)

            'This is usually always 0 for most Steam games except for L4D it's 1
            Dim intAuthSvr1 As Integer = 0

            'Find intAuthSvr2
            Dim intAuthSvr2 As Integer = Nothing
            If intCommunityId Mod 2 Then
                'It's odd
                intAuthSvr2 = 1
            Else
                'It's even
                intAuthSvr2 = 0
            End If

            'Do conversion
            Dim intClientNum As Long = (intCommunityId - intBigNum - intAuthSvr2) / 2
            Return "STEAM_" & CStr(intAuthSvr1) & ":" & CStr(intAuthSvr2) & ":" & CStr(intClientNum)
        Else
            Return CStr(0)
        End If
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        MsgBox(GetCommunityId("STEAM_0:0:1")) 'Will return "76561197960265730"

        MsgBox(GetSteamId("76561197960265730")) 'Will return "STEAM_0:0:1"

    End Sub
End Class

Last edited by lake393; 03-18-2009 at 18:27.
lake393 is offline
Ashcan7
Junior Member
Join Date: Mar 2009
Old 03-18-2009 , 16:00   Re: Convert STEAMID to Steam Community ID
Reply With Quote #154

can anybody make this full downloadable version like there ?
http://www.n00bunlimited.net/index.php?pageid=steam

i need really downloadable version of that :]
Ashcan7 is offline
lake393
AlliedModders Donor
Join Date: Oct 2008
Old 03-18-2009 , 18:02   Re: Convert STEAMID to Steam Community ID
Reply With Quote #155

Quote:
Originally Posted by Ashcan7 View Post
can anybody make this full downloadable version like there ?
http://www.n00bunlimited.net/index.php?pageid=steam

i need really downloadable version of that :]
By fully downloadable, do you mean a desktop application?

If so, I turned the VB.NET functions I wrote above into an application.





Full source code & compiled EXE can be found >> here <<.

Of course, because it is a VB.NET program you will need the .NET framework to run it (if you dont have it already, it can be downloaded for free from Microsoft's website >> here <<.)

Last edited by lake393; 03-18-2009 at 20:24.
lake393 is offline
siosios
SourceMod Donor
Join Date: Jan 2008
Old 03-18-2009 , 21:02   Re: Convert STEAMID to Steam Community ID
Reply With Quote #156

interesting lake, i like that.
__________________
siosios is offline
lake393
AlliedModders Donor
Join Date: Oct 2008
Old 03-18-2009 , 21:40   Re: Convert STEAMID to Steam Community ID
Reply With Quote #157

thanks. i like your script as well ;)
lake393 is offline
Ashcan7
Junior Member
Join Date: Mar 2009
Old 03-19-2009 , 04:44   Re: Convert STEAMID to Steam Community ID
Reply With Quote #158

Quote:
Originally Posted by lake393 View Post
By fully downloadable, do you mean a desktop application?
hah thanx for that but i meant it like zip pack with All PHP files to upload on my webpage :]

i need really much only part with FriendID -> SteamID
but when somebody paste full url link like:
Code:
http://steamcommunity.com/profiles/76561191234567890
or with
Code:
http://steamcommunity.com/id/nick
or with
Code:
Login Nick to steam
i need both three functions in one text box.
was it done or can u make it ?

edit:
i need same script as siosios made on his website ...index.php?pageid=steam. but without typing STEAM_ID in text box :]
Ashcan7 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 03-19-2009 , 15:46   Re: Convert STEAMID to Steam Community ID
Reply With Quote #159

I don't think getting the steamid from the login name is possible, but maybe you're helped with 8088's shared script.

The Steamid->Friendid SQL query was posted very early, so here is the one line Friendid->Steamid SQL query. (For users who don't like devicenull's procedure;))
Code:
SELECT CONCAT("STEAM_0:", (CAST(friendid AS UNSIGNED) - CAST('76561197960265728' AS UNSIGNED)) % 2, ":", CAST(((CAST(friendid AS UNSIGNED) - CAST('76561197960265728' AS UNSIGNED)) - ((CAST(friendid AS UNSIGNED) - CAST('76561197960265728' AS UNSIGNED)) % 2)) / 2 AS UNSIGNED)) AS steam_id
__________________

Last edited by Peace-Maker; 03-21-2009 at 19:21.
Peace-Maker is offline
voogru
Inspector Javert
Join Date: Oct 2004
Old 03-19-2009 , 21:53   Re: Convert STEAMID to Steam Community ID
Reply With Quote #160

Quote:
Originally Posted by Peace-Maker View Post
I don't think getting the steamid from the login name is possible, but maybe you're helped with 8088's shared script.

The Steamid->Friendid SQL query was posted very early, so here is the one line Friendid->Steamid SQL query. (For users who don't like devicenull's procedure;))
Code:
SELECT CONCAT("STEAM_0:", (CAST(friendid AS UNSIGNED) - CAST('76561197960265728' AS UNSIGNED)) % 2, ":", CAST(((CAST(friendid AS UNSIGNED) - CAST('76561197960265728' AS UNSIGNED)) - ((CAST(friendid AS UNSIGNED) - CAST('76561197960265728' AS UNSIGNED)) % 2)) / 2 AS UNSIGNED)) AS steam_id

You can convert their profile name to a steamid using http://steamcommunity.com/id/nick?xml=1
voogru 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 14:39.


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