AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Automatons - question about unregistering a forward (https://forums.alliedmods.net/showthread.php?t=188567)

Backstabnoob 06-27-2012 20:01

Automatons - question about unregistering a forward
 
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?

Neeeeeeeeeel.- 06-27-2012 21:03

Re: Automatons - question about unregistering a forward
 
What means < > ?

fysiks 06-27-2012 23:22

Re: Automatons - question about unregistering a forward
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 1737667)
What means < > ?

Read about automatons. See the tutorials section.

Emp` 06-28-2012 00:01

Re: Automatons - question about unregistering a forward
 
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.

ConnorMcLeod 06-28-2012 01:09

Re: Automatons - question about unregistering a forward
 
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.

Backstabnoob 06-28-2012 06:53

Re: Automatons - question about unregistering a forward
 
I'm going to use it for something completely different, I just wanted to know if this will even work. Thanks for the replies :).

Aooka 06-28-2012 06:56

Re: Automatons - question about unregistering a forward
 
Sorry but I would like to respond about :
Code:
< UspEnabled, KnifeEnabled >
&
Code:
< >

What does that mean ?

Backstabnoob 06-28-2012 06:59

Re: Automatons - question about unregistering a forward
 
Read about automatons in the pawn tutorial.

Aooka 06-28-2012 07:02

Re: Automatons - question about unregistering a forward
 
Okay thanks for the reference

Neeeeeeeeeel.- 06-28-2012 16:48

Re: Automatons - question about unregistering a forward
 
Quote:

Originally Posted by fysiks (Post 1737755)
Read about automatons. See the tutorials section.

Thank you, I'm going to read it.


All times are GMT -4. The time now is 06:11.

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