AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Call a plugin from a plugin (https://forums.alliedmods.net/showthread.php?t=189309)

Veggetta 07-05-2012 18:11

Call a plugin from a plugin
 
I'm recoding my plugin.
And i want to use a plugin inside the main plugin.

PHP Code:

/* THIS IS THE MAIN PLUGIN*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>
#include <engine>
#include <xs>
#include <csx>

#define PLUGIN "Random plugin"
#define VERSION "1.0"
#define AUTHOR "*Vegetta*"

new bool:round1[33]
new 
bool:round2[33]
new 
bool:round3[33]
/*...ETC...*/

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
//Now here is where it begin
    
RegisterHam(Ham_Spawn"player""SelectRound"1);
}

public 
SelectRound(id)
{
    
//Here is where it turn off all the sub plugins
    
round1[id]=false;
    
round2[id]=false;
    
round3[id]=false;
    
set_task(1.2"Rounds");
}

public 
Rounds(id)
{
    new 
rand random_num(1,3)
    switch(
rand)
    {
        case 
1:
        {
            
round1[id]=true;
            
//HERE THE 1šPLUGIN
            //NOW call a plugin where i've a code completly built to do something
            
plugin1.amxx // <- I don't know how to call the whole plugin. callfunc_begin it's just for one 'public'
        
}
        case 
2:
        {
            
round2[id]=true;
            
//HERE THE 2ŠPLUGIN
            
plugin2.amxx // <- THE SAME...
        
}
        
// Etc etc
    
}
}

/*I have the plugin built but it's starting to have much bugs because it's everything inside a .amxx. 
So i want to rebuilt it to have more .amxx 
It's faster and more organize*/ 


wickedd 07-05-2012 18:30

Re: CALL A PLUGIN FROM A PLUGIN
 
Duplicate thread. Here's the first one.

Veggetta 07-05-2012 18:40

Re: CALL A PLUGIN FROM A PLUGIN
 
Yeah i know and sorry for that, but no one answer so i think i post in the wrong section, so i post it here..
I really need to know if its possible to do it like the way i said.

I know it's possible in some way, but i don't know how.

Kreation 07-05-2012 18:48

Re: CALL A PLUGIN FROM A PLUGIN
 
Use natives and the search function.

Liverwiz 07-05-2012 18:49

Re: CALL A PLUGIN FROM A PLUGIN
 
Use an event forward. Best way i can think of doing it....
Check out this thread.

https://forums.alliedmods.net/showthread.php?t=41241

NOTE: This way doesn't require creating natives and all the work that goes into them and an include file. It'll just fire an event that the plugin with that function will then catch and execute.

Not sure why you want to do them in different plugins, just throw them all in one.

Veggetta 07-05-2012 19:00

Re: CALL A PLUGIN FROM A PLUGIN
 
Quote:

Originally Posted by Liverwiz (Post 1744236)
Use an event forward. Best way i can think of doing it....
Check out this thread.

https://forums.alliedmods.net/showthread.php?t=41241

NOTE: This way doesn't require creating natives and all the work that goes into them and an include file. It'll just fire an event that the plugin with that function will then catch and execute.

Not sure why you want to do them in different plugins, just throw them all in one.

I will take a look, thanks a lot.

Veggetta 07-05-2012 19:18

Re: CALL A PLUGIN FROM A PLUGIN
 
Didn't take me anywhere :s ..
Can't anyone do a small code just for understanding ?
I'm not very familiar to Forwards and natives..

Any help ?

fysiks 07-05-2012 19:31

Re: CALL A PLUGIN FROM A PLUGIN
 
The best solution can only be determined after you show us what exactly you are trying to do. (essentially the same thing that I said in the other thread).

Liverwiz 07-05-2012 19:59

Re: CALL A PLUGIN FROM A PLUGIN
 
Quote:

Originally Posted by Veggetta (Post 1744254)
I'm not very familiar to Forwards and natives..

Any help ?

Forwards are REALLY easy. ExecuteForward(forwardHandle, returnValue, parameterToSend)

Bugsy 07-05-2012 20:22

Re: CALL A PLUGIN FROM A PLUGIN
 
If I could understand what you're asking I would help. Give another example to help us understand.


All times are GMT -4. The time now is 15:20.

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