AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   disable CurWeapon event? (https://forums.alliedmods.net/showthread.php?t=13155)

Belsebub 05-06-2005 10:35

disable CurWeapon event?
 
is it possible to disable the CurWeapon event during freezetime?

v3x 05-07-2005 11:48

What are you trying to do?

Belsebub 05-07-2005 12:47

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

Ced 05-07-2005 15:11

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.

Twilight Suzuka 05-07-2005 21:23

You can disable events using register_event. Look it up in the wiki

Belsebub 05-08-2005 04:05

thanks Suzuka, but i didnt find anything, can you show me how to do?

Belsebub 05-13-2005 08:47

bump

xeroblood 05-13-2005 10:23

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:
public Event_CurWeapon( id ) {     if( bFreezeTime ) return PLUGIN_CONTINUE     // do the rest of your code here.. }

That way you don't affect other plugins by removing a commonly used event..

sambro 05-13-2005 11:21

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?

xeroblood 05-13-2005 15:32

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.