AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Putting all plugins in 1 SMA? (https://forums.alliedmods.net/showthread.php?t=128137)

drosado15 05-29-2010 08:53

Putting all plugins in 1 SMA?
 
I'm pretty sure the correct way to do this is put all the includes at the top for all the plugins like so.
// Includes
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>
#include <fakemeta>
#include <hamsandwich>


Then break the plugins up by // correct?

Bugsy 05-29-2010 09:11

Re: Putting all plugins in 1 SMA?
 
Why do you want to do this?

You are lucky if you can copy all functions to one source file and have it work as expected. Don't get me wrong, this can be done but you will need to know what you are doing to make adjustments if/where needed to make it work. Since you're asking this question I will assume you are not very experienced so I would not bother attempting this.

Seta00 05-29-2010 10:11

Re: Putting all plugins in 1 SMA?
 
Copy paste all functions, and add calls to the additional ones in the end of the original functions.
For example, you have two plugins that use Ham_TakeDamage:
Code:
//Plugin 1 plugin_init() {     RegisterHam(Ham_TakeDamage, "player", "Ham_TakeDamage"); } public Ham_TakeDamage(id) {     // mimimi.. }
Code:
//Plugin 2 plugin_init() {     RegisterHam(Ham_TakeDamage, "player", "FwdTakeDamage"); } public FwdTakeDamage(id) {     // bla bla bla... }
:arrow:
Code:
// Plugins merged: plugin_init() {     RegisterHam(Ham_TakeDamage, "player", "Ham_TakeDamage"); // leave only one registration } public Ham_TakeDamage() {     // mimimi..     FwdTakeDamage(id); } public FwdTakeDamage() {     // bla bla bla... }

grimvh2 05-29-2010 11:10

Re: Putting all plugins in 1 SMA?
 
Quote:

Originally Posted by Seta00 (Post 1194321)
Code:
// Plugins merged:
plugin_init() { RegisterHam(Ham_TakeDamage, "player", "Ham_TakeDamage"); // leave only one registration
} public Ham_TakeDamage() { // mimimi.. FwdTakeDamage(id);
} public FwdTakeDamage() { // bla bla bla... }


PHP Code:

// Plugins merged:
plugin_init() {
    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage"); // leave only one registration
}

public 
Ham_TakeDamage() {
    
// mimimi..
    // bla bla bla



Bugsy 05-29-2010 11:51

Re: Putting all plugins in 1 SMA?
 
Quote:

Originally Posted by Seta00 (Post 1194321)
Copy paste all functions, and add calls to the additional ones in the end of the original functions.
For example, you have two plugins that use Ham_TakeDamage:
:arrow:
Code:
// Plugins merged: plugin_init() {     RegisterHam(Ham_TakeDamage, "player", "Ham_TakeDamage"); // leave only one registration } public Ham_TakeDamage() {     // mimimi..     FwdTakeDamage(id); } public FwdTakeDamage() {     // bla bla bla... }

Quote:

Originally Posted by grimvh2 (Post 1194359)
PHP Code:

// Plugins merged:
plugin_init() {
    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage"); // leave only one registration
}

public 
Ham_TakeDamage() {
    
// mimimi..
    // bla bla bla



This won't always work because, for example, one plugin may require altering a param value (and return HAM_HANDLED) while another may require to block all damage (via return HAM_SUPERCEDE). This is why multiple Ham_TakeDamage registers\forwards may be required; it all depends on what the plugins do.

grimvh2 05-29-2010 16:12

Re: Putting all plugins in 1 SMA?
 
Bugsy I am aware of that. The point is, like u have already said. He does'nt have the expierence to put plugins together. He should better leave plugins as they are.

Bugsy 05-29-2010 18:10

Re: Putting all plugins in 1 SMA?
 
Quote:

Originally Posted by grimvh2 (Post 1194624)
Bugsy I am aware of that. The point is, like u have already said. He does'nt have the expierence to put plugins together. He should better leave plugins as they are.

Based on your previous post, it looked as if you were providing a code example for combining multiple takedmg fwds. Hence, my reply.


All times are GMT -4. The time now is 05:16.

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