Raised This Month: $ Target: $400
 0% 

Automatons - question about unregistering a forward


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-27-2012 , 20:01   Automatons - question about unregistering a forward
Reply With Quote #1

Do you think this could work?

PHP Code:

new g_FmSetModelForwardId

public plugin_init( )
{
    
g_FmSetModelForwardId register_forwardFM_SetModel"_FM_SetModel" )

    
set_tasksomething"SomethingNotImportant" )
}


public 
_FM_SetModelentmodel[ ] ) < UspEnabledKnifeEnabled >
{
    
// some code
        
    
return FMRES_IGNORED
}

public 
_FM_SetModelentmodel[ ] ) < >
{
    
unregister_forwardFM_SetModelg_FmSetModelForwardId )
    
    return 
FMRES_IGNORED
}

public 
SomethingNotImportant( )
{
    
state somethingevenlessimportant UspEnabled
    state 
somethinglessimportantthanabove KnifeEnabled


I'm not sure if unregistering the forward in empty automaton handler works. Has anyone tried doing this and was successful?
Backstabnoob is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-27-2012 , 21:03   Re: Automatons - question about unregistering a forward
Reply With Quote #2

What means < > ?
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-27-2012 , 23:22   Re: Automatons - question about unregistering a forward
Reply With Quote #3

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
What means < > ?
Read about automatons. See the tutorials section.
__________________
fysiks is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-28-2012 , 00:01   Re: Automatons - question about unregistering a forward
Reply With Quote #4

Why not:
Code:
public SomethingNotImportant( )
{
    if ( somethingevenlessimportant || somethinglessimportantthanabove )
        g_FmSetModelForwardId = register_forward( FM_SetModel, "_FM_SetModel" ) 
}
But your method would hypothetically work, you would just have to be careful because SetModel < > might be called before SomethingNotImportant.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-28-2012 , 01:09   Re: Automatons - question about unregistering a forward
Reply With Quote #5

Emp is right, it doesn't seem that you need an automaton here.
Also, suppose SetModel is called before 'something' task delay, forward will be disabled when the task is executed and your fonction won't ever be called.

When you can enable/disable forwards such as with fakemeta and hamsandwich, seems better to do it.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-28-2012 , 06:53   Re: Automatons - question about unregistering a forward
Reply With Quote #6

I'm going to use it for something completely different, I just wanted to know if this will even work. Thanks for the replies .
Backstabnoob is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-28-2012 , 06:56   Re: Automatons - question about unregistering a forward
Reply With Quote #7

Sorry but I would like to respond about :
Code:
< UspEnabled, KnifeEnabled >
&
Code:
< >

What does that mean ?
__________________
Pawn ? Useless
Aooka is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-28-2012 , 06:59   Re: Automatons - question about unregistering a forward
Reply With Quote #8

Read about automatons in the pawn tutorial.
Backstabnoob is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-28-2012 , 07:02   Re: Automatons - question about unregistering a forward
Reply With Quote #9

Okay thanks for the reference
__________________
Pawn ? Useless
Aooka is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-28-2012 , 16:48   Re: Automatons - question about unregistering a forward
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
Read about automatons. See the tutorials section.
Thank you, I'm going to read it.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
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 06:11.


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