get_user_weapon or native?
I have a simple doubt, in a plugin there is a variable that contains the current weapon having a player.
This variable exists for prevent calling get_user_weapon many times, because would be called in events like takedamage, traceattack... The variable works perfectly in the plugin, buy I have some subplugins that are using get_user_weapon in client_PreThink or other forwards, and the question is What is more efficient method: calling get_user_weapon or make native with the main plugin to use it instead of get_user_weapon ? I say get_user_weapon like an example, but the same with is_user_alive, is_user_connected... Thanks :) |
Re: get_user_weapon or native?
In case of get_user_weapon you allowed to cache using CurWeapon Event, and checking in takedamage or other events.
In case of is_user*, this need to be called when the function starts (takedamage, etc) :) |
Re: get_user_weapon or native?
Quote:
He want to know which method is more efficient |
Re: get_user_weapon or native?
Quote:
Who asked you surely know what I'm answering. |
Re: get_user_weapon or native?
Quote:
|
Re: get_user_weapon or native?
For forwards, you need to make it to use with other plugins, i recommend to use using CurWeapon event, because it is only called when player really change bettwen weapons.
:) |
Re: get_user_weapon or native?
Quote:
@Baneado its hard to say unless you show your code or explain what your trying to do otherwise its really going to be XY problem. However, I can't imagine why you would need to use get_user_weapon() inside client_PreThink. |
Re: get_user_weapon or native?
I second that.
Anyway, your question is abstract, we need to know exactly what you are doing in plugins with PreThink so we can tell you if there are alternatives or not. For sure, PreThink is a bad function to hook in many situations. |
Re: get_user_weapon or native?
In "miscstats" (CS) plugin we have interesting bug: when player kill another player for example, with AWP and fast switch to weapon to knife, then plugin (client_death() function) get CSW_KNIFE as weapon of kill...
This case? How to fix? |
Re: get_user_weapon or native?
Quote:
|
| All times are GMT -4. The time now is 23:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.