[SOLVED]hook cmd to register/unregister forward
which way is better and efficienter to register and unregister my forwards.
using Cvar Utilities or ClientCommand? |
Re: hook cmd to register/unregister forward
Cvar Utilities is about cvar, not command.
Now all is depending what you want to do. If you want to provide a way to customize your plugin, cvar is more appropriate. There is not reason to try to use a command. About un/registering I don't think there is real difference. The difference would be more when the forward is enabled. ClientCommand will be called for all the commands and you would need to check the strings each time. With CvarUtilities, the forward is called only on cvar value change, and for the cvar(s) specified. And in the situation you hook a bunch of cvar on the same callback, you could check the cvar pointer instead of string. So, when the forward is enabled, Cvar Utililies would be more efficient. |
Re: hook cmd to register/unregister forward
the forwards are enabled. so i will use Utilities.
thanks Arkshine. |
Re: hook cmd to register/unregister forward
1 Attachment(s)
so i dont open a new thread.
i think we knew that this will happend :P init: PHP Code:
PHP Code:
secund : when i change the cvar ingame ( with amxx menu ) and set it to 0, for first time will the cvars value showed as Fullpack_post you can see it in attached pic. i changed the cvar to 0 but ... http://forums.alliedmods.net/attachm...1&d=1303480215 |
Re: hook cmd to register/unregister forward
You do things wrongly.
Please take your time by reading the examples provided in the module thread. Like this one : https://forums.alliedmods.net/showth...okSpecificCvar You see clearly how the header of the callback should be. How I would do : Code:
You could have used str_to_num( newValue ) or get_pcvar_num( handleCvar ), but here we can avoid the use of natives. Actually, I would use a code more safer, because people could have written wrong things. So, I would recommendend something like to be sure : Code:
EDIT : I will fix it, but I would like to encourage you to use CVarRegister() instead, where the bug doesn't exist, EDIT2: So, at the end, I would do : Code:
EDIT 3: Sorry for my answers. Actually, it's fine as it is, I mean about what i've said in my first edit. I would prefer to not change to avoid further problem. So I would suggest finaly something like :p : Code:
|
Re: hook cmd to register/unregister forward
hmmm thanks but its not working :(
here my console : Code:
] amx_semiclip_enabledwhen i check the cvar its on 0. so i try to change it to 1 & semiclip is off ( unregistered ). i check the cvar value it showed me its on 0.000000 did i forget something ? should i post the full code ? |
Re: hook cmd to register/unregister forward
Just use new handleCvar = CvarRegister( "amx_semiclip_enabled", "1" ) to see.
|
Re: hook cmd to register/unregister forward
wow. its working. awesome.
Thanksssssssssss. yaaaaaaaaaay |
Re: [SOLVED]hook cmd to register/unregister forward
Something wrong with bounds, but already fixed in the next release. 'Glad it works now.
|
Re: [SOLVED]hook cmd to register/unregister forward
its just perfect. i like it :D
w8 for new update :P GJ |
| All times are GMT -4. The time now is 20:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.