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

Get steamid number


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Touch
Member
Join Date: Apr 2010
Location: Ukraine
Old 08-02-2011 , 12:37   Get steamid number
Reply With Quote #1

Hello
Please tell us as soon as possible from STEAM_0:0:29367947 to 0:29367947.
That is, cut STEAM_0:.
PHP Code:
decl String:steamid[256];
GetClientAuthString(clientsteamidsizeof(steamid));

# We need a variable that will contain only steamid number (without "STEAM_0:") 
Very thanks!
Touch is offline
Send a message via Skype™ to Touch
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 08-02-2011 , 12:41   Re: Get steamid number
Reply With Quote #2

PHP Code:
decl String:steamid[256]; 
GetClientAuthString(clientsteamidsizeof(steamid)); 

PrintToChatAll("%s"steamid[8]); // Will print: "0:29367947" in your case 
That will get a reference of the string from the 9th character. You could transpose it back onto the string with strcopy but there's really no need.
__________________

Last edited by pheadxdll; 08-02-2011 at 12:44.
pheadxdll is offline
ajr1234
Senior Member
Join Date: Mar 2011
Location: Chicago, IL, U.S.A.
Old 08-03-2011 , 03:32   Re: Get steamid number
Reply With Quote #3

I have a stock that may help you:
PHP Code:
stock GetSteamID(clientString:authstr[], maxlen)
{
    
GetClientAuthString(clientauthstrmaxlen);
    if(
StrEqual(authstr"STEAM_ID_LAN"false))
    
GetClientIP(clientauthstrmaxlen);
    
ReplaceString(authstrmaxlen"STEAM_0:"""false);
    
ReplaceString(authstrmaxlen"STEAM_1:"""false);

Use it like this:
PHP Code:
decl String:buffer[256];
GetSteamID(clientbuffersizeof(buffer));
// buffer now holds the steam ID 
ajr1234 is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 08-03-2011 , 15:46   Re: Get steamid number
Reply With Quote #4

Quote:
Originally Posted by ajr1234 View Post
I have a stock that may help you:
PHP Code:
stock GetSteamID(clientString:authstr[], maxlen)
{
    
GetClientAuthString(clientauthstrmaxlen);
    if(
StrEqual(authstr"STEAM_ID_LAN"false))
    
GetClientIP(clientauthstrmaxlen);
    
ReplaceString(authstrmaxlen"STEAM_0:"""false);
    
ReplaceString(authstrmaxlen"STEAM_1:"""false);

Use it like this:
PHP Code:
decl String:buffer[256];
GetSteamID(clientbuffersizeof(buffer));
// buffer now holds the steam ID 
don't use this.
__________________
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
ajr1234
Senior Member
Join Date: Mar 2011
Location: Chicago, IL, U.S.A.
Old 08-03-2011 , 23:34   Re: Get steamid number
Reply With Quote #5

Quote:
Originally Posted by berni View Post
don't use this.
Someone told me the same thing once before. May I ask what's wrong with it?
ajr1234 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-04-2011 , 11:19   Re: Get steamid number
Reply With Quote #6

Quote:
Originally Posted by ajr1234 View Post
Someone told me the same thing once before. May I ask what's wrong with it?
Complicated do simple thing,
What @pheadxdll post #2 you can not get simpler than it is.

sry bad english
Bacardi is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 08-05-2011 , 14:22   Re: Get steamid number
Reply With Quote #7

Well, you could convert the number into a useable Intiger ID. This is what i use.

PHP Code:
//Covert To String:
SteamIdToInt(ClientnBase 10)
{
    
decl String:SteamId[64], String:subinfo[3][16];
    
GetClientAuthString(ClientSteamIdsizeof(SteamId));
    
ExplodeString(SteamId":"subinfosizeof(subinfo), sizeof(subinfo[]));
    new 
Int StringToInt(subinfo[2], nBase);
    if(
StrEqual(subinfo[1], "1")) Int *= -1;
    return 
Int;

Credits go to Sammy Rocks. And me for some ajustments.
__________________
Master(d)




Last edited by Master53; 08-05-2011 at 15:10.
Master53 is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 08-05-2011 , 14:26   Re: Get steamid number
Reply With Quote #8

PHP Code:
//Initulize

//Declare:
decl

//Explode:
Explode

//Return:
return 
lol, silly comment author ?

This sucks too, doesn't have any advantages over pheadxdll's example.
I would prefer the long 64 Bit Friends ID then.
__________________
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
Master53
Veteran Member
Join Date: Dec 2009
Old 08-05-2011 , 15:10   Re: Get steamid number
Reply With Quote #9

Edited and is now better. I normally use a intiger based steam id when using SQL because it speeds up SQL and less data is transfered although it does the same thing.
__________________
Master(d)




Last edited by Master53; 08-05-2011 at 15:14.
Master53 is offline
Reply


Thread Tools
Display Modes

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 00:50.


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