Raised This Month: $ Target: $400
 0% 

GetClientOfUserId


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BenSib
Senior Member
Join Date: Aug 2008
Old 03-31-2009 , 05:06   GetClientOfUserId
Reply With Quote #1

something that I still dont understand is the handling of userid. if I use for example GetClientOfUserId(i) and GetClientOfUserId(target) it does NOT return the userid displayed when you type "status" in console.

In SM documentation it says that GetClientOfUserId "Translates an userid index to the real player index". Could you quickly explain me what exactly it does?

If I define i:
Code:
        new maxClients = GetMaxClients();        
        for (new i = 1; i < maxClients; i++)
How would you get the userid of "i" for ex.?
BenSib is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 03-31-2009 , 05:08   Re: GetClientOfUserId
Reply With Quote #2

That returns the client index. You are looking for GetClientUserId().

Also...As of SM 1.2 you can just use MaxClients. Theres no reason to use GetMaxClients() anymore.
__________________
CrimsonGT is offline
BenSib
Senior Member
Join Date: Aug 2008
Old 03-31-2009 , 05:17   Re: GetClientOfUserId
Reply With Quote #3

ok thanks, but I can get the client name of "i" with:

GetClientName(i, playerName, sizeof(playerName));

where is the userid?

btw: Maybe there is something that I completely ignore ;)
BenSib is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 03-31-2009 , 05:19   Re: GetClientOfUserId
Reply With Quote #4

Im not exactly sure what you are trying to do. In your code, "i" would be the player index, so doing GetClientUserId(i) would return the client's userid.
__________________
CrimsonGT is offline
BenSib
Senior Member
Join Date: Aug 2008
Old 03-31-2009 , 05:30   Re: GetClientOfUserId
Reply With Quote #5

right thanks, the return can obviously not be print to chat:

PrintToChat(target, "That is the userid: %s", GetClientUserId(i));

Last edited by BenSib; 03-31-2009 at 05:57.
BenSib is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 03-31-2009 , 05:55   Re: GetClientOfUserId
Reply With Quote #6

GetClientUserId(i) returns an index, so you need %d (an integer value), not %s (a string)
__________________
CrimsonGT is offline
BenSib
Senior Member
Join Date: Aug 2008
Old 03-31-2009 , 05:58   Re: GetClientOfUserId
Reply With Quote #7

omg thats it. Much thanks CrimsonGT!
BenSib is offline
BAILOPAN
Join Date: Jan 2004
Old 03-31-2009 , 08:39   Re: GetClientOfUserId
Reply With Quote #8

You're missing the last client, that should be <= not <
__________________
egg
BAILOPAN 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 11:23.


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