Raised This Month: $ Target: $400
 0% 

unregister_forward example question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-08-2014 , 04:30   unregister_forward example question
Reply With Quote #1

Here's the deal, I have a jailbreak daysmenu plugin that uses
PHP Code:
register_forward(FM_PlayerPreThink"fwd_playerprethink"
, but only for two days. At the moment I am using if(checks day) inside it and that's horrible, so I'm asking if I can unregister the forward and only register it while the day starts?

How would that work? Could anyone give an example?

Fill this in for me please
Code:
public plugin_init() { register_forward(FM_PlayerPreThink, "fwd_playerprethink") } public days_start() { switch(day) { case 1: //need it here case 2: //don't need it here } } public days_end() { //??? }
aron9forever is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-08-2014 , 04:45   Re: unregister_forward example question
Reply With Quote #2

Search for examples. There are a couple threads that use it. You can also look at the documentation for those functions for an idea of how to use them.

After you look at those resources, try some code. If it doesn't work, post your code here.
__________________

Last edited by fysiks; 06-08-2014 at 04:48.
fysiks is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-08-2014 , 04:51   Re: unregister_forward example question
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Search for examples. There are a couple threads that use it. You can also look at the documentation for those functions for an idea of how to use them.

After you look at those resources, try some code. If it doesn't work, post your code here.
I've only found documentation in polish, and even there, it's not explained.

by the basic guess from an old amxx glitch thread I guess it's something like this?

Code:
new g_forwardID public plugin_init() { //register_forward(FM_PlayerPreThink, "fwd_playerprethink") } public days_start() { switch(day) { case 1: g_forwardID = register_forward(FM_PlayerPreThink, "fwd_playerprethink")//need it here case 2: //don't need it here } } public days_end() { switch(day) { case 1: unregister_forward(FM_PlayerPreThink, g_forwardID) case 2: //stuff } }

Can you please confirm this as working? I don't have a testing environment set up and I can't test it live at this hour, that's the only reason I ask here, because I can't look at this and tell for sure it will work but others can

Last edited by aron9forever; 06-08-2014 at 04:52. Reason: added switch at the end
aron9forever is offline
Reply


Thread Tools
Display Modes

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 09:46.


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