Raised This Month: $ Target: $400
 0% 

Get ID by STEAMID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sandurr
Senior Member
Join Date: Aug 2005
Old 12-30-2005 , 12:55   Get ID by STEAMID
Reply With Quote #1

Hi,

Is it possible to get a players ID when having his STEAMID?

Ty
Sandurr is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-30-2005 , 15:09  
Reply With Quote #2

Code:
stock get_user_id(const authid[]) {     new players[32], num, i;     get_players(players, num, "c");     for(i=0;i<num;i++) {         new check[32];         get_user_authid(players[i],check,31);         if(equali(authid,check)) return players[i];     }     return 0;  }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 12-30-2005 , 15:25  
Reply With Quote #3

Note that it'd be better to declare the "check" variable outside of the for loop. When the compiler sees the declaration of a variable it reserves space on the stack and then sets the bytes to zero. So it's better to do it once instead of doing it each iteration.
__________________
hello, i am pm
PM is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-30-2005 , 15:32  
Reply With Quote #4

Last time I tried that I had problems. I declared a variable outside a while loop, and inside the while loop I would assign it a value. The value always returned blank. When I made the variable declaration inside of the while loop, it worked fine. I thought it was a weird scope issue.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 12-30-2005 , 15:39  
Reply With Quote #5

Yes, it would be helpful if you could post the code, maybe some non-lazy developer would look into it. (actually, we are all lazy, so don't)
__________________
hello, i am pm
PM is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 12-30-2005 , 16:09  
Reply With Quote #6

Isn't the lost processing speed negligable?

And I consider myself non-lazy...to an extent...
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 12-30-2005 , 16:20  
Reply With Quote #7

In this case, it most likely is, but there are people who like to point out any possible reasonable optimisation they see, mainly because they want to give good advice in case someone would like to implement a similar loop on a larger scale.

Why waste processor cycles anyway?
__________________
hello, i am pm
PM is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 12-30-2005 , 16:32  
Reply With Quote #8

Cause it looks infinitely better? ^^
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
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 15:59.


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