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

Question about get_user_info() & get_user_name()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
predator
Junior Member
Join Date: Aug 2004
Old 08-19-2004 , 15:42   Question about get_user_info() & get_user_name()
Reply With Quote #1

Hey, I was looking through the list of functions and while viewing the info for client_infochanged() I saw the following example code.

Code:
public client_infochanged(id)
{
    new newname[32],oldname[32];
    get_user_info(id, "name", newname,31);
    get_user_name(id,oldname,31);
    client_print(0,3,"%s has changed his name to %s",oldname,newname);
}
As I understand it, and I'm guessing I understand incorrectly, the get_user_info() line and the get_user_name() line do exactly the same thing. Therefore the newname and oldname strings would be exactly the same. If someone could explain to me how/why/if this code actually gets both the old and new names I would appreciate it.
__________________
predator is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 08-19-2004 , 17:43  
Reply With Quote #2

Yes, this code actually does work.
It works because AMX(x) executes the client_infochanged forwards before updating its internal name buffers.

So get_user_name will get the name that AMX(x) has in its buffers, which is the old one.
get_user_info will get the new name.
After that forward is executed, AMX(x) sets it internal buffers to the new name too.
__________________
hello, i am pm
PM is offline
predator
Junior Member
Join Date: Aug 2004
Old 08-19-2004 , 17:49  
Reply With Quote #3

I see. Thanks for clearing that up for me PM.
__________________
predator 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 17:46.


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