Raised This Month: $51 Target: $400
 12% 

Call a plugin from a plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Veggetta
Member
Join Date: Mar 2008
Location: Portugal
Old 07-05-2012 , 18:11   Call a plugin from a plugin
Reply With Quote #1

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*/ 

Last edited by Veggetta; 07-06-2012 at 07:10.
Veggetta is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 07-05-2012 , 18:30   Re: CALL A PLUGIN FROM A PLUGIN
Reply With Quote #2

Duplicate thread. Here's the first one.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Veggetta
Member
Join Date: Mar 2008
Location: Portugal
Old 07-05-2012 , 18:40   Re: CALL A PLUGIN FROM A PLUGIN
Reply With Quote #3

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.

Last edited by Veggetta; 07-05-2012 at 18:43.
Veggetta is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 07-05-2012 , 18:48   Re: CALL A PLUGIN FROM A PLUGIN
Reply With Quote #4

Use natives and the search function.
__________________
Hi.
Kreation is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 07-05-2012 , 18:49   Re: CALL A PLUGIN FROM A PLUGIN
Reply With Quote #5

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.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 07-05-2012 at 18:51.
Liverwiz is offline
Veggetta
Member
Join Date: Mar 2008
Location: Portugal
Old 07-05-2012 , 19:00   Re: CALL A PLUGIN FROM A PLUGIN
Reply With Quote #6

Quote:
Originally Posted by Liverwiz View Post
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 is offline
Veggetta
Member
Join Date: Mar 2008
Location: Portugal
Old 07-05-2012 , 19:18   Re: CALL A PLUGIN FROM A PLUGIN
Reply With Quote #7

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 ?

Last edited by Veggetta; 07-05-2012 at 19:20.
Veggetta is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-05-2012 , 19:31   Re: CALL A PLUGIN FROM A PLUGIN
Reply With Quote #8

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).
__________________
fysiks is online now
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 07-05-2012 , 19:59   Re: CALL A PLUGIN FROM A PLUGIN
Reply With Quote #9

Quote:
Originally Posted by Veggetta View Post
I'm not very familiar to Forwards and natives..

Any help ?
Forwards are REALLY easy. ExecuteForward(forwardHandle, returnValue, parameterToSend)
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-05-2012 , 20:22   Re: CALL A PLUGIN FROM A PLUGIN
Reply With Quote #10

If I could understand what you're asking I would help. Give another example to help us understand.
__________________

Last edited by Bugsy; 07-05-2012 at 20:24.
Bugsy is offline
Reply



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 14:35.


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