'Hybrid' Plugin?
Hello there guys, i'm a newbie here. I have a simple question regarding plugins. Is it possible to make "hybrid" plugin e.g. Extra Items for ZP and for vanilla mode just in one .sma ?
Imagine having zp_xxx.sma and normal_xxx.sma which is exact same file and the difference is only zp_ natives thing and register_clcmd for obtaining the item. What a pain.. |
Re: 'Hybrid' Plugin?
it is possible and you have 2 way:
1. Using Module filter and check libary zp50_core (since it usually there) and then use Native Filter to prevent an error throw at you when you check zp_get_user_zombie. After that, you can just check Libary to see if they are running ZP or not PHP Code:
The downside is it not work with ZP 4.3 since ZP 4.3 was not used Library 2. Make a #define and make #if every time you need to separate between ZP and Normal. Here I used #if defined PHP Code:
But with this, you have to manually change and have to compile again. P/S: I am not sure with filter way since I haven't try it yet but you could take look at ZP 5.0 Main Menu as example P/S2: If you use native for plugins then the second one is more ideal since you have to register_native (which called before plugin_init) |
Re: 'Hybrid' Plugin?
Quote:
|
Re: 'Hybrid' Plugin?
Quote:
PHP Code:
Code:
Because zombieplague.inc doesn't have libary, it can't be check this way. |
Re: 'Hybrid' Plugin?
Quote:
PHP Code:
|
Re: 'Hybrid' Plugin?
Quote:
|
Re: 'Hybrid' Plugin?
Quote:
|
Re: 'Hybrid' Plugin?
The inc has nothing to do with creating the library, it is simply loading it for you. The library is created in the plugin itself by calling register_library. If there is no library as in zp43, you won't need module_filter, just native_filter. You could do something like this
Code:
#include <amxmodx>Code:
enum |
Re: 'Hybrid' Plugin?
Quote:
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:
PHP Code:
|
Re: 'Hybrid' Plugin?
Quote:
Quote:
Quote:
|
| All times are GMT -4. The time now is 11:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.