View Single Post
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 09-19-2015 , 07:37   Re: Check client against custom community string
Reply With Quote #2

Technically, it is possible to do - but not directly by using SteamTools / SteamWorks alone.

You would need to call the Steam API to resolve the vanity URL to the numerical format.

You didn't specify how exactly your users are inserting this into your DB, but under the assumption that this happens from a website, the easiest (and most likely best) way would be to to re-develop your website, and make your website handle the vanity URL resolving.

That way, you won't use your with your precious gaming resources on doing that, and your game servers can simply select the information they need, rather than first converting from one thing to another.

The call format to do it is to execute a HTTP call to
Code:
https://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=STEAM_API_KEY&vanityurl=CUSTOM_USERNAME_STRING_HERE
Using the vanity URL "John", you would (at the time of writing this) receive a JSON response with:

Code:
{
        "response": {
                "steamid": "76561197985607672",
                "success": 1
        }
Meaning that those are the same user:
- http://steamcommunity.com/id/John
- http://steamcommunity.com/profiles/76561197985607672

By saving only "76561197985607672", and not "John" into your database, you wouldn't have to worry about users changing their vanity URL either.

I hope this helps you.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline