AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fake Forwards (https://forums.alliedmods.net/showthread.php?t=88772)

Exolent[jNr] 03-29-2009 02:12

Fake Forwards
 
Is it a problem to have something like this:
Code:
forward my_forward(); new g_forward, g_return; public plugin_natives() {     register_library("my_library");         g_forward = CreateMultiForward("my_forward", ET_IGNORE); } //... ExecuteForward(g_forward, g_return);

ot_207 03-29-2009 04:02

Re: Fake Forwards
 
Are you asking wether the forward that a plugin creates can exist in that plugin?
If so, I think yes..

ConnorMcLeod 03-29-2009 06:28

Re: Fake Forwards
 
It's not a problem, it will be a forward with no params.
You may be interested in create single forwards for each plugins that needs it, like it's done in atac plugin, don't know what is the best though, just think like orangutanz wouldn't have bother to do it if it wasn't making any benefit.

AntiBots 03-29-2009 09:01

Re: Fake Forwards
 
No, Any problem. my_forward()

Exolent[jNr] 03-29-2009 14:58

Re: Fake Forwards
 
Quote:

Originally Posted by ot_207 (Post 791923)
Are you asking wether the forward that a plugin creates can exist in that plugin?
If so, I think yes..

This is what I was talking about.
Can anyone else back this up? I'd like a definite answer.

ot_207 03-29-2009 15:01

Re: Fake Forwards
 
Quote:

Originally Posted by Exolent[jNr] (Post 792520)
This is what I was talking about.
Can anyone else back this up? I'd like a definite answer.

I trully don't see why it should not work. Beeing a multi forward the core will automatically call the function in every plugin, and that includes the one that created it.

Edit:
If you want you can test that in my speed api.
http://forums.alliedmods.net/showthread.php?t=77940
put the forward in it and see what happens...

Emp` 03-29-2009 18:04

Re: Fake Forwards
 
Code:

new SkillForward[TOTAL_SKILLS+1] = {-1, ...}

//...

 ValidSkillForward( const skill )
 {
        if( !ValidSkill(skill) ){
                return -1;
        }
        if( SkillForward[skill] == -1 ){
                if( SkillInfo[skill] & SI_PUBLIC )
                        SkillForward[skill] = CreateMultiForward( SkillName[skill], ET_STOP, FP_CELL, FP_CELL, FP_CELL);
                else
                        SkillForward[skill] = CreateOneForward( plugin_id, SkillName[skill], FP_CELL, FP_CELL, FP_CELL );
        }
        return SkillForward[skill];
 }

//...

 ExecuteForward( ValidSkillForward(skill), temp_return, id, skill, prop );

Works fine for me


All times are GMT -4. The time now is 08:59.

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