Raised This Month: $ Target: $400
 0% 

'Hybrid' Plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 09-23-2021 , 23:05   Re: 'Hybrid' Plugin?
Reply With Quote #1

Quote:
Originally Posted by CrazY. View Post
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[], indextrap)
{
    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_zp43register_native("zp_get_cannon""Native_Get_Cannon"1);
}

public 
native_filter(const name[], indextrap)
{
    if (
equal(name"zp_register_extra_item"))
    {
        if (!
trap)
            
g_mod_zp43 false

        
return PLUGIN_HANDLED
    
}

    return 
PLUGIN_CONTINUE

__________________
My plugin:

Last edited by Celena Luna; 09-24-2021 at 00:37.
Celena Luna 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 11:35.


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