Raised This Month: $ Target: $400
 0% 

Retrive a last numbers after ':' from SteamID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 05-08-2013 , 18:48   Retrive a last numbers after ':' from SteamID
Reply With Quote #1

Hey, i need a some help to separate the numbers of SteamID;

example:

PHP Code:
new szSteam[35];
get_user_authid(id,szSteam,charsmax(szSteam));  // Its will return my Steam: STEAM_0:1:20326844

new szLeft[16],szRight[16];
    
strtok(szSteam,szLeft,charsmax(szLeft),szRight,charsmax(szRight),':');

server_print(szRight); // Its will return ":20326844" 
Any suggestion?

Ps. I used search but not really a useful results

EDIT:

I used this method and problem solved:

PHP Code:
    new szLeft[16],szRight[16];
    
strtok(szSteam,szLeft,charsmax(szLeft),szRight,charsmax(szRight),':');
    
strtok(szRight,szLeft,charsmax(szLeft),szRight,charsmax(szRight),':');
    
    
server_print(szRight); 
But its another better way?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 05-08-2013 at 18:56.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 05-08-2013 , 19:55   Re: Retrive a last numbers after ':' from SteamID
Reply With Quote #2

PHP Code:
static ascount,numbers[16], posscount 0pos 0
for(0charsmax(szSteam); a++)
{
if(!
szSteam[a]) {
numbers[pos] = 0
break
}
if(
scount >= && szSteam[a] != ':' ) {
numbers[pos] = szSteam[a]
pos++
continue
}
if( 
szSteam[a] == ':' scount++


Last edited by .Dare Devil.; 05-08-2013 at 19:56.
.Dare Devil. is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-08-2013 , 19:58   Re: Retrive a last numbers after ':' from SteamID
Reply With Quote #3

This ?

PHP Code:
{
    new 
szAuthid[32];
    
get_user_authid(idszAuthidcharsmax(szAuthid));
    
szAuthid[9] = EOS;
    
server_print("Left:%s , Right:%s"szAuthidszAuthid[10]);


You always have weird question. You would have better to tell what you want to do with the steamid.
I remember having trouvle with ':' and replace simply with '_' like this :

szAuthid[7] = szAuthid[9] = '_';

And to reverse, so simple :

szAuthid[7] = szAuthid[9] = ':';
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 05-08-2013 , 20:41   Re: Retrive a last numbers after ':' from SteamID
Reply With Quote #4

But its still fix a SteamID for one size not?
Its example my SteamID, but i need basically to retrive the last numbers, to use with a unique set_task()
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-09-2013 , 06:15   Re: Retrive a last numbers after ':' from SteamID
Reply With Quote #5

Then, ask in first post that you want to use that number and not the string, prevent people from spend some time for nothing.

PHP Code:
new g_szAuthid[33][32];
new 
g_iPlayersAUTH[33];

public 
client_authorizedid )
{
    
get_user_authid(idg_szAuthid[id], charsmax(g_szAuthid[]));
    
g_iPlayersAUTH[id] = str_to_numg_szAuthid[10] );

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-09-2013 at 06:16.
ConnorMcLeod is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-09-2013 , 07:39   Re: Retrive a last numbers after ':' from SteamID
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
Then, ask in first post that you want to use that number and not the string, prevent people from spend some time for nothing.
Yet another statistic to the currently increasing XY Problem.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet 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 10:51.


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