• UniqueID <=> SteamID
    55 replies, posted
[QUOTE=Nevec;17364679]SteamID sometimes returns 'STEAM_ID_PENDING' when ran from PlayerInitialSpawn. It is easily solved by delaying the hook, but it's still annoying. Is this the case with UniqueID as well?[/QUOTE]As far as I know, yes. UserID is available though, I think.
-Snip-
function GM:PlayerAuthed( ply, SteamID, UniqueID ) Use that to generate it.
This may be a bump, But this a good solution, [code] string.Replace(ply:SteamID(),":",";") [/code] so it comes out like this Steam_0;0;111111111 instead of Steam_0:0:111111111 and therefore is savable
[lua]local SteamID = "STEAM_0:1:21096928" local Output = string.gsub(string.gsub(SteamID,"STEAM_",""),":","") print(Output)[/lua] Prints: 0121096928 *shrug*
[QUOTE=Skapocalypse;17519454][lua]local SteamID = "STEAM_0:1:21096928" local Output = string.gsub(string.gsub(SteamID,"STEAM_",""),":","") print(Output)[/lua] Prints: 0121096928 *shrug*[/QUOTE] do string.Replace
[QUOTE=Noobulater;17519817]do string.Replace[/QUOTE] I think his point is that 0121096928 is much shorter and easier to use. ;)
[QUOTE=Noobulater;17519817]do string.Replace[/QUOTE] do string.gsub
I feel useful. <3
[lua]local steamid = "STEAM_0:1:21096928"; local numbers = steamid:gsub( "STEAM_(%d+):(%d+):(%d+)", "%1%2%3" );[/lua] Don't use string.Replace, gsub is what you should be using.
[QUOTE=Lexic;17342866]It's not. I know this because my roleplay server stores everything in a database with the user's uniqueID as the primary key. As the database has survived multiple server reinstalls and even a hardware switch, UniqueID is clearly not based on what server you're on. [editline]10:40PM[/editline] Been through 3 IP changes too, if you were thinking of mentioning the server's IP.[/QUOTE] You shouldn't really rely on the Unique ID being constant over long periods of time. As soon as they change Steam ID's it makes it useless (like when they changed it earlier to 1's instead of 0's.)
[QUOTE=Emz;17528615]You shouldn't really rely on the Unique ID being constant over long periods of time. As soon as they change Steam ID's it makes it useless (like when they changed it earlier to 1's instead of 0's.)[/QUOTE] Yeah, but if they did that, it'd make everything else useless too, so what's your point? You shouldn't rely on the ground being there over long periods of time, because of coastal erosion.
When they changed the Steam ID it was only one digit and was easy to convert between the 2. The Unique ID could change multiple digits making it harder to convert between. And that is my point. It was a suggestion. No need to get sassy about it.
[QUOTE=Emz;17528795]When they changed the Steam ID it was only one digit and was easy to convert between the 2. The Unique ID could change multiple digits making it harder to convert between. And that is my point. It was a suggestion. No need to get sassy about it.[/QUOTE] Thank you for your concern. However, as I don't think Valve will do that again after all the outcry from last time, I'll stick with UniqueID for now. [editline]12:19PM[/editline] Ok people. This is over 10,000 Unique IDs with their corresponding SteamIDs. Let's see if we can find something in common, eh? [code]Running script dumpUniqueIDS.lua... Initialising UniqueID Grabber 228486315,STEAM_0:0:11558013 3349547274,STEAM_0:1:1780259 2730719028,STEAM_0:0:17039092 1553588123,STEAM_0:0:2113398 1516317454,STEAM_0:1:15968603 2308894852,STEAM_0:1:13668008 1960336531,STEAM_0:0:6020576 1034755740,STEAM_0:0:8812777 1344481280,STEAM_0:0:6006260 737008734,STEAM_0:1:12229592 2097517132,STEAM_0:0:20094893 3272569654,STEAM_0:1:14651617 2504819040,STEAM_0:0:18548917 1809353775,STEAM_0:1:15411625 3393162866,STEAM_0:0:6167077 3716547335,STEAM_0:0:295342 676870278,STEAM_0:0:16737174 135815207,STEAM_0:0:10580735 2190478388,STEAM_0:0:3300405 2044868410,STEAM_0:1:7869460 2166903410,STEAM_0:1:17237739 1558753631,STEAM_0:0:14744982 3823192744,STEAM_0:0:5106902 2079383171,STEAM_0:1:16192034 2233192580,STEAM_0:1:17206843 4074929585,STEAM_0:0:4876798 61151607,STEAM_0:0:12907760 3648069356,STEAM_0:0:14827905 1444544503,STEAM_0:0:6607376 116577898,STEAM_0:0:19433352 4105318598,STEAM_0:1:18766268 2721368395,STEAM_0:0:13418715 1675894498,STEAM_0:1:14531808 1285406333,STEAM_0:1:11572033 3755644660,STEAM_0:1:1428687 2718989606,STEAM_0:0:13852629 2797129590,STEAM_0:0:20479832 1300289034,STEAM_0:1:20451697 572442750,STEAM_0:1:13479990 3231045693,STEAM_0:1:4816792 3669283835,STEAM_0:0:21519308 3832166791,STEAM_0:1:14677035 2711709335,STEAM_0:0:21482536 4234025111,STEAM_0:0:5281982 4127372463,STEAM_0:1:19033126 846161671,STEAM_0:1:5447949 3619711427,STEAM_0:1:4763520 2772306824,STEAM_0:1:8521752 2586902673,STEAM_0:0:15525276 92827875,STEAM_0:0:15797439 102231203,STEAM_0:0:20535088 446291271,STEAM_0:1:16775071 1235808154,STEAM_0:0:15055138 2118989078,STEAM_0:0:14719380 948163926,STEAM_0:1:13381623 4219605820,STEAM_0:1:12055896 13059432,STEAM_0:0:13839766 2999012682,STEAM_0:1:6111701 3741163697,STEAM_0:0:5237841 1371536678,STEAM_0:1:17480382 4248673310,STEAM_0:0:15589435 1025329041,STEAM_0:0:14483295 1460408338,STEAM_0:1:19625183 935099081,STEAM_0:1:20368149 1352327676,STEAM_0:0:18420073 409657291,STEAM_0:0:14479252 912557590,STEAM_0:1:12808689 416565522,STEAM_0:1:1087300 1584876738,STEAM_0:1:18724623 715695176,STEAM_0:1:16376163 2192249267,STEAM_0:1:19295846 2014382268,STEAM_0:1:18896902 3386267517,STEAM_0:0:21005376 4260634545,STEAM_0:0:20093348 695286748,STEAM_0:0:15744964 2477565325,STEAM_0:0:15347139 1400578004,STEAM_0:1:7495319 1568680278,STEAM_0:1:18368362 616800509,STEAM_0:1:14618763 1668012159,STEAM_0:0:9835179 1175144874,STEAM_0:1:12769801 4025829658,STEAM_0:0:3619940 1438081483,STEAM_0:0:5313119 3410677984,STEAM_0:1:6044629 1221843037,STEAM_0:0:6494542 938870417,STEAM_0:0:16814936 312164535,STEAM_0:1:15066274 4237131340,STEAM_0:0:14799202 2902765862,STEAM_0:0:16127185 3350785062,STEAM_0:1:21389950 2100502600,STEAM_0:1:19037499 22553655,STEAM_0:1:8173660 1363515259,STEAM_0:1:9315574 857562683,STEAM_0:1:13106902 212506032,STEAM_0:0:3144427 870756851,STEAM_0:1:18546644 3531289609,STEAM_0:0:18689913 1256107250,STEAM_0:1:18980029 3993640703,STEAM_0:1:18831923 1756468003,STEAM_0:0:10818263 3049487932,STEAM_0:1:8990957 2017131674,STEAM_0:1:15406168 3014501303,STEAM_0:1:3751091 95287054,STEAM_0:1:18189187 3540158552,STEAM_0:1:19332845 1506988363,STEAM_0:1:19348230 3861362337,STEAM_0:1:17923727 1757672829,STEAM_0:0:21475266 823103115,STEAM_0:1:18923430 2730383172,STEAM_0:0:20303079 2618130321,STEAM_0:1:19755972 3812267457,STEAM_0:1:11953018 354655919,STEAM_0:1:6241324 242790471,STEAM_0:1:12956620 3338935385,STEAM_0:1:20046775 1475092150,STEAM_0:0:12930966 3979921065,STEAM_0:1:16580286 350467268,STEAM_0:1:19605565 2038546502,STEAM_0:0:21555306 671107897,STEAM_0:0:12492533 3349855641,STEAM_0:0:16999905 1992531201,STEAM_0:1:17081597 3620643266,STEAM_0:1:17586106 2044737759,STEAM_0:0:8944068 3112790018,STEAM_0:0:17118923 3503581669,STEAM_0:1:17153248 77367842,STEAM_0:0:20681744 55651469,STEAM_0:0:19173236 1210243595,STEAM_0:0:21609834 305028909,STEAM_0:1:16239497 1795247015,STEAM_0:1:12845640 3306119571,STEAM_0:0:1058087 694411990,STEAM_0:1:19733077 3177964130,STEAM_0:1:17458286 1160491037,STEAM_0:1:19588552 3330211237,STEAM_0:0:13709985 4289211744,STEAM_0:0:1544895 1572765278,STEAM_0:0:15317295 1786979459,STEAM_0:1:4178761 2380495896,STEAM_0:0:17436688 1106808083,STEAM_0:1:15676429 119265712,STEAM_0:1:12389558 3988940630,STEAM_0:1:20641338 2035776630,STEAM_0:0:7529502 1101151852,STEAM_0:0:16963499 1634376001,STEAM_0:1:18478061 3615973826,STEAM_0:0:3806233 3324439925,STEAM_0:0:133121 2191185987,STEAM_0:1:13360997 1135550274,STEAM_0:1:13863249 4202141671,STEAM_0:0:9949215 705407068,STEAM_0:0:16172182 294118747,STEAM_0:1:15003202 1295388687,STEAM_0:1:18414910 538251778,STEAM_0:0:11027413 3378956605,STEAM_0:1:8188229 290077840,STEAM_0:0:17502940 3505049484,STEAM_0:0:7327051 2897735604,STEAM_0:1:20109619 1677823850,STEAM_0:1:8325384 656789548,STEAM_0:1:12821590 3486340533,STEAM_0:1:8594974 1474952382,STEAM_0:0:18920163 489056134,STEAM_0:1:3110229 1651679756,STEAM_0:1:11651466 1413969637,STEAM_0:1:14044637 769064157,STEAM_0:1:8634725 801904014,STEAM_0:0:16404239 4118454419,STEAM_0:1:16838745 187545278,STEAM_0:0:16843816 643474807,STEAM_0:0:19365390 2826911705,STEAM_0:1:18586954 985106452,STEAM_0:1:18862514 1994799441,STEAM_0:0:17129759 1142830060,STEAM_0:1:19755043 3524574731,STEAM_0:1:6272843 3034714678,STEAM_0:1:11468988 2611133836,STEAM_0:0:16361391 2162973601,STEAM_0:0:17703341 3227440866,STEAM_0:1:10422811 733513486,STEAM_0:0:18103570 1610850930,STEAM_0:0:18995440 3675090611,STEAM_0:0:17558816 3481424301,STEAM_0:0:10809525 1366789824,STEAM_0:0:5567906 3520561334,STEAM_0:1:12756310 2699607538,STEAM_0:0:18298089 181671628,STEAM_0:0:13379135 3620094871,STEAM_0:0:20061779 3472978238,STEAM_0:1:6991976 1277998855,STEAM_0:0:5119072 2718807262,STEAM_0:0:16242894 3328794253,STEAM_0:0:12871808 1617035410,STEAM_0:0:9831606 2973702228,STEAM_0:0:20848708 1468749785,STEAM_0:0:13277439 1335697699,STEAM_0:0:1860392 2992695493,STEAM_0:0:122715 1593506299,STEAM_0:0:10209438 4033148880,STEAM_0:0:19572739 727380524,STEAM_0:0:11773720 2824448143,STEAM_0:0:13048913 572534259,STEAM_0:1:15541966 3446126532,STEAM_0:1:8679057 1415620661,STEAM_0:0:9954160 1636172901,STEAM_0:0:12873888 41969762,STEAM_0:0:17509686 1412887809,STEAM_0:0:18038622 3891857314,STEAM_0:0:10022616 492759101,STEAM_0:0:15571890 850055971,STEAM_0:1:20844676 4131091609,STEAM_0:1:15194746 4103955991,STEAM_0:0:17564959 313125437,STEAM_0:0:13947788 1167133040,STEAM_0:0:17451979 3674921705,STEAM_0:1:15542952 85509602,STEAM_0:0:13510367 1555022936,STEAM_0:1:2041939 3784177635,STEAM_0:1:17328778 1872184268,STEAM_0:1:15826986 3378837286,STEAM_0:0:15658690 941175416,STEAM_0:1:21161233 2312341741,STEAM_0:0:19819332 3374838103,STEAM_0:1:5356515 4192509728,STEAM_0:0:18770942 3848485140,STEAM_0:1:13912549 668495144,STEAM_0:0:21110432 174469651,STEAM_0:0:20110413 3417869904,STEAM_0:1:9152598 3127595036,STEAM_0:0:11015244 613567432,STEAM_0:1:3598616 2913427893,STEAM_0:0:17824462 1367800912,STEAM_0:0:5678832 1480763242,STEAM_0:1:17331712 2367982805,STEAM_0:1:11770509 3999314185,STEAM_0:0:18473919 756921962,STEAM_0:1:19817567 1285740560,STEAM_0:0:15872099 739484336,STEAM_0:1:18304333 2458951683,STEAM_0:0:2062632 4116551539,STEAM_0:1:5260835 651026285,STEAM_0:0:2419276 310599074,STEAM_0:1:20365268 1674906369,STEAM_0:1:14915331 2883805689,STEAM_0:0:14026752 687998371,STEAM_0:1:19125893 4027710414,STEAM_0:0:13487620 2920183884,STEAM_0:1:18845139 128479209,STEAM_0:0:14419399 3996954998,STEAM_0:0:14107862 2090471466,STEAM_0:1:14985331 2015427468,STEAM_0:0:18540604 3025542417,STEAM_0:0:15670282 2425618018,STEAM_0:0:5916467 4108241548,STEAM_0:0:17219007 3000533874,STEAM_0:1:1852
-snip-
This might help: [code]2978212617 - STEAM_0:1:26262687 3923835743 - STEAM_0:1:26262688 1365023802 - STEAM_0:1:26262689 288684544 - STEAM_0:1:26262690[/code]
[QUOTE=Skondra;17540230]This might help: [code]2978212617 - STEAM_0:1:26262687 3923835743 - STEAM_0:1:26262688 1365023802 - STEAM_0:1:26262689 288684544 - STEAM_0:1:26262690[/code][/QUOTE] Not seeing much of a pattern there, but... why don't we just look at the source of player:UniqueID()? [editline]12:00AM[/editline] [QUOTE=Noobulater;17519817]do string.Replace[/QUOTE] Why? It's a shit copy of string.gsub.
[QUOTE=Retirsch;17540292]Not seeing much of a pattern there, but... why don't we just look at the source of player:UniqueID()?[/QUOTE] Because Garry's Mod isn't open source.
Maybe there's just no pattern and it's randomly assigned to us by Steam, just like the SteamID.
Right from [url=http://developer.valvesoftware.com/wiki/SteamID#Steam_ID_as_a_Steam_Community_ID]Valve's Wiki[/url], [quote] Steam ID as a Steam Community ID A Steam ID can be converted to Steam Community ID for use on the Steam Community website by applying the following formula to the SteamID: * Let X,Y, and Z be defined by the Steam ID: STEAM_X:Y:Z * Let W be defined by the Steam Community ID: steamcommunity.com/profiles/W <math>W = (Z \times 2) + 76561197960265728 + Y\,</math> By performing the reverse operation, a Community ID can also be converted to a Steam ID. [/quote]
[QUOTE=deadeye536;17556718]Right from [url=http://developer.valvesoftware.com/wiki/SteamID#Steam_ID_as_a_Steam_Community_ID]Valve's Wiki[/url],[/QUOTE] We're aware of this, we're looking for a connection between the SteamID and the UniqueID, not the Community ID. :)
[QUOTE=Crazy Quebec;17556801]We're aware of this, we're looking for a connection between the SteamID and the UniqueID, not the Community ID. :)[/QUOTE] Yeah, my bad for not checking... Right after I posted, I realized that the equation didn't work with the examples above. I'm now thinking about a connection between Profile's ID and Unique ID...
05:24.46 ( Lexi ) Oh garry, if you're still about, could you possibly post the algorthim player:UniqueID() uses to generate the player's UniqueID please? It'd help me out a bit with something I'm trying to do. 05:25.02 ( @garry ) no 05:25.07 ( Lexi ) Oh. Why not? 05:25.11 ( @garry ) it's a secret 05:25.17 ( Lexi ) ): 05:25.34 ( @garry ) TOP secret If I were garry I would have implemented it as [lua] util.CRC("gm_" .. ply:SteamID() .. "_gm") [/lua]
[QUOTE=AzuiSleet;17562464]05:24.46 ( Lexi ) Oh garry, if you're still about, could you possibly post the algorthim player:UniqueID() uses to generate the player's UniqueID please? It'd help me out a bit with something I'm trying to do. 05:25.02 ( @garry ) no 05:25.07 ( Lexi ) Oh. Why not? 05:25.11 ( @garry ) it's a secret 05:25.17 ( Lexi ) ): 05:25.34 ( @garry ) TOP secret If I were garry I would have implemented it as [lua] util.CRC("gm_" .. ply:SteamID() .. "_gm") [/lua][/QUOTE] [code]] lua_run print(util.CRC("gm_"..Entity(1):SteamID().."_gm")==Entity(1):UniqueID()) > print(util.CRC("gm_"..Entity(1):SteamID().."_gm")==Entity(1):UniqueID())... true[/code] Thanks! [editline]07:45AM[/editline] I guess this means we can't convert it back. ): [editline]07:46AM[/editline] ...Also couldn't you potentially end up with two players with the same uniqueID from collisions?
A more appropriate storage method would be to store the steamid64, the profile id, you can potentially store it as "iAuthID * 2 + iServer" since all the steam ids exist in the same universe and have the same account type. You would just add 0x110000100000000 (the account type and universe) to get the full 64bit id.
I know this is gravedigging but here you go. [url]http://pastebin.com/CeqVXPD7[/url] [highlight](User was banned for this post ("dumb bump" - Orkel))[/highlight]
Sorry, you need to Log In to post a reply to this thread.