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

Get CommunityID (SteamID64) String


Post New Thread Reply   
 
Thread Tools Display Modes
disawar1
AlliedModders Donor
Join Date: Aug 2011
Location: Russian
Old 08-07-2012 , 05:47   Re: Get CommunityID (SteamID64) String
Reply With Quote #11

or check here
__________________
disawar1 is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 08-07-2012 , 07:17   Re: Get CommunityID (SteamID64) String
Reply With Quote #12

Quote:
Originally Posted by disawar1 View Post
Did you just throw in that post to look pretty?
This is for doing what steamidfinder does inside of Sourcepawn.
minimoney1 is offline
Echo_can
Junior Member
Join Date: Mar 2012
Old 12-02-2012 , 23:13   Re: Get CommunityID (SteamID64) String
Reply With Quote #13

ok i am a bit of a newb to coding but im looking to do this but have a fuction that checks a mysql database for the steamid and then write to it with the community id in the next column and i cant figure it out
Echo_can is offline
vodka00
Veteran Member
Join Date: Jun 2012
Location: Los Angeles
Old 12-04-2012 , 03:50   Re: Get CommunityID (SteamID64) String
Reply With Quote #14

What is STEAMID64?
__________________
cw main:

cw speedruns:
vodka00 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-04-2012 , 10:22   Re: Get CommunityID (SteamID64) String
Reply With Quote #15

Quote:
Originally Posted by vodka00 View Post
What is STEAMID64?
The Steam ID for user profiles on the steamcommunity site, at least if you don't have a short profilename set in your profile settings.

They look something like 76561197972407386.

The reason they're called STEAMID64 is because they are too large to be stored in a 32-bit number.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 12-04-2012 at 10:23.
Powerlord is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 12-11-2012 , 14:11   Re: Get CommunityID (SteamID64) String
Reply With Quote #16

Update to First Post:

I've just rewritten the function in the first post to be smaller and more efficient, and now allows for leading zeros if the output string is too large. Hopefully this upgrade should be pretty final.
__________________

Last edited by 11530; 12-11-2012 at 14:19.
11530 is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 12-14-2012 , 13:23   Re: Get CommunityID (SteamID64) String
Reply With Quote #17

Code:
bool:GetFriendID(String:AuthID[], String:FriendID[], size)
{
    ReplaceString(AuthID, strlen(AuthID), "STEAM_", "");
    if (StrEqual(AuthID, "ID_LAN"))
    {
        FriendID[0] = '\0';
        return false;
    }
    decl String:toks[3][16];
    new upper = 765611979;
    new String:temp[12], String:carry[12];

    ExplodeString(AuthID, ":", toks, sizeof(toks), sizeof(toks[]));
    new iServer = StringToInt(toks[1]);
    new iAuthID = StringToInt(toks[2]);
    new iFriendID = (iAuthID*2) + 60265728 + iServer;

    if (iFriendID >= 100000000)
    {
        Format(temp, sizeof(temp), "%d", iFriendID);
        Format(carry, 2, "%s", temp);
        new icarry = StringToInt(carry[0]);
        upper += icarry;

        Format(temp, sizeof(temp), "%d", iFriendID);
        Format(FriendID, size, "%d%s", upper, temp[1]);
    }
    else
    {
        Format(FriendID, size, "765611979%d", iFriendID);
    }

    return true;
}
this is way better than doing big number additions with strings
__________________
Taking private C++/PHP/SourcePawn requests, PM me.

Last edited by Zephyrus; 12-14-2012 at 13:23.
Zephyrus is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 12-14-2012 , 19:00   Re: Get CommunityID (SteamID64) String
Reply With Quote #18

Zephyrus, your version looks pretty slow to me. Unless you think integer addition is slower than using temp strings, multiple formats, StringToInts, ReplaceStrings, and needless if-statements - not to mention the fact your code won't detect other non-normal SteamIDs. Most of your code really isn't needed (and about 50% longer) - you should think twice before saying those functions are way better than basic addition/subtraction. Please think again before posting code which is very similar to a post someone made a year ago too.

Just to confirm your code however, I've ran a quick profile on it, running each function 100,000 times. Twice.

Your code - Avg. Time: 0.081687 then 0.094406 (0.0880465 total avg.)
My code - Avg. Time: 0.072591 then 0.067664 (0.0701275 total avg.)

Profilers are never complete proof, but at least it stops you, Zephyrus, from using awkward phrases like "this is way better".
__________________

Last edited by 11530; 12-15-2012 at 07:50.
11530 is offline
PriceLess
Senior Member
Join Date: Sep 2012
Location: Jungle
Old 12-18-2012 , 11:46   Re: Get CommunityID (SteamID64) String
Reply With Quote #19

Impressive work =)
__________________
sincerely PriceLess
PriceLess is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-18-2012 , 17:03   Re: Get CommunityID (SteamID64) String
Reply With Quote #20

Quote:
Originally Posted by 11530 View Post
Zephyrus, your version looks pretty slow to me. Unless you think integer addition is slower than using temp strings, multiple formats, StringToInts, ReplaceStrings, and needless if-statements - not to mention the fact your code won't detect other non-normal SteamIDs. Most of your code really isn't needed (and about 50% longer) - you should think twice before saying those functions are way better than basic addition/subtraction. Please think again before posting code which is very similar to a post someone made a year ago too.

Just to confirm your code however, I've ran a quick profile on it, running each function 100,000 times. Twice.

Your code - Avg. Time: 0.081687 then 0.094406 (0.0880465 total avg.)
My code - Avg. Time: 0.072591 then 0.067664 (0.0701275 total avg.)

Profilers are never complete proof, but at least it stops you, Zephyrus, from using awkward phrases like "this is way better".
To be honest, Zephyrus's version could probably be optimized by replacing the Formats with strcats and IntToStrings as appropriate, but I'm too lazy to see if it actually makes a difference.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 12-18-2012 at 17:04.
Powerlord 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 12:05.


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