client_infochanged Efficiency
Hey, I'm trying to optimize my plugin to max, and I've cached Name, SteamID and IP on client_authorized instead of retrieving them hundreds of times.
Now I have to deal with name changing, so I have this PHP Code:
PHP Code:
|
Re: client_infochanged Efficiency
since you asked for optimization
PHP Code:
|
Re: client_infochanged Efficiency
client_infochanged is a pre event and it triggers for other things too besides name.
get_user_info gets the "name" cvar from the client side, which can be different from the one server-sided. Use this instead: PHP Code:
PHP Code:
|
Re: client_infochanged Efficiency
The main thing: infochanged is not only about the name.
You have to check if it is the name that was changed or other info. |
Re: client_infochanged Efficiency
Here's a potential solution. For some reason it will repeat the forward based on the number of times you've changed your name, but at least ClientUserInfoChanged wouldn't be getting spammed for just hooking name change.
PHP Code:
|
Re: client_infochanged Efficiency
Quote:
Quote:
BTW, I'm using this in plugin #1 (I'm doing this so I can have old and new name in log) PHP Code:
PHP Code:
|
Re: client_infochanged Efficiency
Quote:
Georgik's way was also good, but FM_ClientUserInfoChanged got called on connection, meanwhile your code only got called when player changed name. |
Re: client_infochanged Efficiency
Quote:
Setting the argument to 1 fixes the problem. Thanks for this, I implemented it in my rank system. |
Re: client_infochanged Efficiency
Quote:
register_forward with last arg 1, unregister_forward with arg 1, name doesn't update. register_forward with last arg 0, unregister_forward with arg 1, name doesn't update. register_forward with last arg 0, unregister_forward with arg 0, name doesn't update. register_forward with last arg 1, unregister_forward with arg 0, works. |
Re: client_infochanged Efficiency
3rd argument in unregister_forward should be removed it doesnt make any sense.
|
All times are GMT -4. The time now is 07:34. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.