Optimizing question.
I have to hook the use of a single func_button, depending on the targetname.
It is possible that the button doesn't exist though. So i was wondering what's the best way to hook it. 1. Hook Ham_Use and check if it's the right button there. 2. Loop through all entities at plugin_init() and use RegisterHamFromEntity. Ofcourse you can post another method if it's better then my 2 idea's. :3 EDIT: And if i hook the button in pre and return HAM_SUPERCEDE, will that block the button to activate the stuff that it's supposed to do ? |
Re: Optimizing question.
RegisterHamFromEntity registers the function for a class, so it will register for all fun_button.
So, loop through all func_button, if the button is found, cache its index in a global var and register Ham_Use, "func_button", and in the callback compare the entity index. |
Re: Optimizing question.
Cool, thanks ConnorMcLeod.
What about SUPERCEDE, will it block the button from being used ? |
Re: Optimizing question.
returning HAM_SUPERCEDE here
PHP Code:
|
Re: Optimizing question.
Okay, Thanks for your help.
|
| All times are GMT -4. The time now is 11:18. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.