Raised This Month: $51 Target: $400
 12% 

[Solved] enable_event / disable_event (Also log events)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-22-2017 , 21:34   [Solved] enable_event / disable_event (Also log events)
Reply With Quote #1

Hi, nice to see new natives on Amx Mod X 1.8.3-dev like:

enable_event(handle) & disable_event(handle) (used with register_event)

also

enable_logevent(handle) & disable_logevent(handle) (used with register_logevent)

I only suggesting to add more two natives:

bool:is_logevent_enabled(handle) also bool:is_event_enabled(handle) or a do better way.

Ps. Re-HLDS discussion is not allowed here
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 03-22-2017 at 21:34.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-22-2017 , 21:35   Re: enable_event / disable_event (Also log events)
Reply With Quote #2

Quote:
Originally Posted by ^SmileY View Post
Ps. Re-HLDS discussion is not allowed here
Then you shouldn't mention it . . . because you just mentioned it, it becomes on-topic.
__________________
fysiks is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-22-2017 , 22:38   Re: enable_event / disable_event (Also log events)
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Then you shouldn't mention it . . . because you just mentioned it, it becomes on-topic.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-23-2017 , 04:22   Re: enable_event / disable_event (Also log events)
Reply With Quote #4

Keep track of your events. You already have an event ID as a variable once you register it, so when unregistering it just make it 0. That will actually be faster than doing a native call (trivially, but eh).

Last edited by klippy; 03-23-2017 at 04:22.
klippy is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-23-2017 , 07:08   Re: enable_event / disable_event (Also log events)
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
Keep track of your events. You already have an event ID as a variable once you register it, so when unregistering it just make it 0. That will actually be faster than doing a native call (trivially, but eh).
No i gues, the handle for event 'g_hEvent = register_event(...)' will not change when you disable/enable it ??
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 03-23-2017 , 08:12   Re: enable_event / disable_event (Also log events)
Reply With Quote #6

register_event just pass an integer as a return value.
So it's just an authentification number of the event.
I have no idea how it work, i didn't checked the code that much.
That mean if you set the value to 0, for sure disable and enable will have no effect on 0.

One main way i see to track this is using an independant global variable boolean just before or after you enable/disable an event.

Last edited by Fr33m@n; 03-23-2017 at 08:12.
Fr33m@n is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-23-2017 , 08:17   Re: enable_event / disable_event (Also log events)
Reply With Quote #7

Quote:
Originally Posted by Fr33m@n View Post
register_event just pass an integer as a return value.
So it's just an authentification number of the event.
I have no idea how it work, i didn't checked the code that much.
That mean if you set the value to 0, for sure disable and enable will have no effect on 0.

One main way i see to track this is using an independant global variable boolean just before or after you enable/disable an event.
but if you use a global var, you still need to use a native on plugin. Since variable will be stored on amxx side.

i have sure that g_hNative = register_event(), if you changed g_hNative will not enable/disable it.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-23-2017 , 08:35   Re: enable_event / disable_event (Also log events)
Reply With Quote #8

Just keep track of enabled status in a separate variable.
klippy is offline
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 03-23-2017 , 10:10   Re: enable_event / disable_event (Also log events)
Reply With Quote #9

Quote:
Originally Posted by KliPPy View Post
Just keep track of enabled status in a separate variable.
That what i said but i believe he didn't understand.
Fr33m@n is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode