Support Forums

Full Version: [SF Coders] Converting between SteamID's and Friend Profile ID's
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[Image: YzwzC.png]

Welcome to another tutorial, brought to you by SF Coders. Today I'm going to teach you how to convert a Steam ID into a Profile ID (Similar to this) in Visual Basic .NET - Also easily modified for C# .NET.

Let's begin! First you will need either the persons Steam ID or Friend ID, I'm going to be using my own Friend ID (http://steamcommunity.com/id/TheMilopeach/) Although, as this only works with the original ID of the account, we will need to look into the source code and find the 17 digit version of 'TheMilopeach'.

Open the community page (i.e. http://steam..../TheMilopeach/) and view the source code (As all are basically a modified web page.) and find the string var invitee = " - Make sure it is invitee, not inviter as the inviter is your current account you are using to view the page with and will always be the same.

Now that we have the 17 digit number we can convert it to the Steam ID of that user. (Mine is 76561197960775000).

First - the GUI, Let's start with 2 Labels, 2 Textboxes and a Button. Arrange it like so, or if you have a previous project, throw it in the mix somewhere.

[Image: ?h=aca52eafde95355893df032bd9f0fdd1]

Credits for these functions go to Lake393 from Alliedmods. Thread: http://forums.alliedmods.net/showthread.php?p=784611

Don't forget to Imports System.Text.... Big Grin

The first function will be the GetSteamID function. This will use our 17 digit number to convert to a STEAM_X:X:XXX...

[Image: ?h=9d0b1074a89d2010c34d41b46bc10ceb]

The second will be he GetCommunityID function. This will use our Steam ID and convert it into a community ID.

[Image: ?h=28025a3a2e842df63a4adf4f85fac493]

Once we have that, We'll edit our code to do a little mutation once our button is clicked.

[Image: ?h=889cf81b4406e8caeda45f1071c924cd]


That should do it, Fiddle around with the If statement or make it automatically change and edit when you type in the textbox. There are a few bugs when converting, you must only have 1 textbox with text at any one time.

Hope it helped,
Milopeach.
It's really good to see that SF coders are doing well and keeping the forum active Smile although I'm not a coder , I appreciate it personally Big Grin
Another nice tutorial, well done Milo.
Looks nice, and i see you use images so you can't copy paste the codes well done Smile
Yet ANOTHER Great tutorial from milopeach, You are like the most active in this section on this whole forum!
Wow, this is really helpful but the images are dead D: