disable CurWeapon event?
is it possible to disable the CurWeapon event during freezetime?
|
What are you trying to do?
|
lets say i have a code that sets the players speed to 400 if he uses a knife, and i use the CurWeapon event to set his speed to 400 when he equip the knife.
and if he equip the knife during the freezetime, he can move. and i wanna disable the CurWeapon event so he cant move if he equip the knife during freezetime |
you don't want to remove the event, you just want to check if he's in freezetime. But currently, I do not remember how to do it, youo would get the server freezetime cvar and then other things that I don't remember.
|
You can disable events using register_event. Look it up in the wiki
|
thanks Suzuka, but i didnt find anything, can you show me how to do?
|
bump
|
Just watch for the freezetime, and during freezetime set a global variable to True, and after freezetime set it to False..
Then, in your CurWeapon event function, just check if the variable is True, and if so then exit the function immediately.. kinda like: Code:
That way you don't affect other plugins by removing a commonly used event.. |
Xero, how would you check freezetime?
I dunno what the situation is in AMXX, but back at AMX, you had to register_logevent the round start, but it was only called after freezetime? I've noticed people using ResetHUD, is this the one that gets called as soon as a round starts? |
Well, there are a couple ways to check.. not sure which is the most effecient though.. maybe it depends on what you are doing exactly..
Anyway, you could just catch the Round End event and then make the flag variable 'bFreezeTime' equal True. And then catch the Round Start event which is fired after freezetime, and set the flag variable back to False.. Or, you could catch the first ResetHUD event setting the flag to True, and then set a task for the length of the mp_freezetime cvar, which then sets the flag back to False.. |
| All times are GMT -4. The time now is 16:49. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.