AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   detect plugin (https://forums.alliedmods.net/showthread.php?t=320801)

Sanjay Singh 01-10-2020 07:15

detect plugin
 
how can I detect plugin if its running or not.

I want to enable func only when that plugin is running.

PHP Code:

plugin_running()
    
func_mod()
else
    return 
0;

func_mod()
{




OciXCrom 01-10-2020 07:21

Re: detect plugin
 
For the 15th time, use the API.

https://www.amxmodx.org/api/amxmodx/is_plugin_loaded

The name of the function is pretty logical so you could have easily found it if you tried searching.

Sanjay Singh 01-10-2020 07:51

Re: detect plugin
 
Quote:

Originally Posted by OciXCrom (Post 2679627)
For the 15th time, use the API.

https://www.amxmodx.org/api/amxmodx/is_plugin_loaded

The name of the function is pretty logical so you could have easily found it if you tried searching.

I tried this but plugin shows bad load in amx_plugins
I used this command
PHP Code:

is_plugin_loaded("test.amxx",true


OciXCrom 01-10-2020 08:05

Re: detect plugin
 
For the 120th time - show the full error.

Sanjay Singh 01-10-2020 08:14

Re: detect plugin
 
I am using api of xp plugin
PHP Code:

<xpapi

but xp plugin is not loaded it will load only on specific map so (maps folder plugins-de_dust2.ini)

but I compiled my plugin with that include <xpapi> and added in default plugins.ini

Error: amx_plugins
PHP Code:

unknown unknown Bad Load 

Shows error In normal maps but in map which load xp plugin is loaded will work fine for plugin.

why this plugin not working in normal maps.

OciXCrom 01-10-2020 09:56

Re: detect plugin
 
Show the full code and the full error when the server starts.

I'm 99% sure that you get a "bad load" because you're using a function from a plugin that isn't loaded. Using "is_plugin_loaded" won't prevent such errors. You need to use a native filter to check if the natives are avaialble.

Check my Knife Models plugin to see how I included natives from my Rank System and use them if the plugin is loaded (lines 9-20, 764-780).

Shadows Adi 01-10-2020 12:23

Re: detect plugin
 
public plugin_init()
{
//some code
}


All times are GMT -4. The time now is 02:55.

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