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

[HOWTO] detect if plugin is loaded from another plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Master53
Veteran Member
Join Date: Dec 2009
Old 07-15-2011 , 12:44   [HOWTO] detect if plugin is loaded from another plugin
Reply With Quote #1

how do you detect if a plugin has failed to load or not loaded when being called from "AskPluginLoad2" forward.
__________________
Master(d)



Master53 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-15-2011 , 13:12   Re: [HOWTO] detect if plugin is loaded from another plugin
Reply With Quote #2

If your plugin has a dependency on another plugin, as long as the other plugin's include file is set up properly, and you don't put
PHP Code:
#undef REQUIRE_PLUGIN 
before you include its include file, your plugin should fail to load if its dependency isn't met.

Some plugins do have a "bad" include file. One such plugin is SourceBans, whose include file assumes it's always optional without the other plugin telling it so.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Pawn 3-pg
Senior Member
Join Date: Jul 2009
Old 07-15-2011 , 13:28   Re: [HOWTO] detect if plugin is loaded from another plugin
Reply With Quote #3

FindPluginByFile and GetPluginStatus should do what you want.
Pawn 3-pg is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 07-16-2011 , 11:04   Re: [HOWTO] detect if plugin is loaded from another plugin
Reply With Quote #4

Example code used

PHP Code:
//All Plugins Loaded:
public OnAllPluginsLoaded()
{

    
//Handle:
    
new Handle:PFind FindPluginByFile("PluginName.smx");

    
//Find:
    
if(PFind != INVALID_HANDLE
    {

        
//Plugin Status:
        
if(GetPluginStatus(PFind) != Plugin_Running)
        {

            
//Fail State:
            
SetFailState("test");
        }
    }

    
//Override:
    
else
    {

        
//Fail State:
        
SetFailState("test");
    }

__________________
Master(d)



Master53 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 16:54.


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