Quote:
Originally Posted by asdian
how to use that native filter to prevent error with zp_ natives ?
|
PHP Code:
new bool:IsZPRunning = false //Boolean to check if ZP is running.
public plugin_natives()
{
set_native_filter("native_filter")
set_module_filter("module_filter")
}
public native_filter(const name[], index, trap)
{
if(!trap)
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public module_filter(const module[])
{
if (equal(module, "zp50_core"))
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
public plugin_init()
{
if(LibraryExists("zp50_core", LibType_Library))
IsZPRunning = true //if zp50_core loaded, plugin will be in ZP mode
}
//I will make example here when tanking damage
public fw_Player_TakeDamage(victim, inflictor, attacker, Float:Damage, iDamageBits)
{
if(IsZPRunning)
{
if(zp_core_is_zombie(id)
{
//Do ZP stuff
SetHamParamFloat(4, 2000.0)
}
}
else
{
//Do Normal CS Mode stuff
SetHamParamFloat(4, 100.0)
}
}
If you want to know if there is a Libary, check the include file
Code:
#if AMXX_VERSION_NUM >= 175
#pragma reqlib zp50_core
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib zp50_core
#endif
#else
#pragma library zp50_core
#endif
Because zombieplague.inc doesn't have libary, it can't be check this way.
__________________