Quote:
Originally Posted by CrazY.
The inc has nothing to do with creating the library, it is simply loading it for you.
|
I haven't used it for awhile now so I forgot.
So
_zombieplague_included already defined in zombieplague.inc so we just need to check it to see if ZP is running or not, don't need to create a new #define. Noted.
But it still required user to re-compile the plugins with the compiler that doesn't have
zombieplague.inc in the include folder or remove the
#include <zombieplague> in the plugins. Which isn't what he want.
Also, it would only handle
zp_register_extra_item in your example. If the plugins contain another native
zp_get_user_zombie or
zp_class_nemesis_get would throw an error.
This is what I came up with
PHP Code:
public plugin_natives()
{
set_native_filter("native_filter")
}
public native_filter(const name[], index, trap)
{
if (equal(name, "zp_get_user_zombie")) //For both ZP43 & ZP5.0+ compat
{
if (!trap)
g_mod_zp43 = false
return PLUGIN_HANDLED
}
//Just filter all of them to prevent throwing error
if (!trap)
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public do_something(id)
{
if(g_mode_zp43)
{
if(zp_class_nemesis_get(id))
do_stuff(id)
}
else
{
do_normal_mode_stuff(id)
}
}
@CrazY. Is it possible to do something like this? Since OP want the native only create for ZP and clcmd for Normal
PHP Code:
public plugin_natives()
{
set_native_filter("native_filter")
if(g_mode_zp43) register_native("zp_get_cannon", "Native_Get_Cannon", 1);
}
public native_filter(const name[], index, trap)
{
if (equal(name, "zp_register_extra_item"))
{
if (!trap)
g_mod_zp43 = false
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
__________________