Quote:
Originally Posted by client21
But my goal is to create native "Test_z" with a delay.
|
I'm confused by what you mean here, you create natives in AskPluginLoad2 to ensure all other plugins on your server can use the native as long as they have the include file. You can mark natives as optional in the include file so if you unload the plugin you created the native in, the other plugins using it can still run and won't fail to load.
Example:
z.inc
PHP Code:
#if defined _z_included
#endinput
#endif
#define _z_included
native int Test_Z();
public SharedPlugin __pl_z =
{
name = "z",
file = "z.smx",
#if defined REQUIRE_PLUGIN
required = 1,
#else
required = 0,
#endif
};
#if !defined REQUIRE_PLUGIN
public void __pl_z_SetNTVOptional()
{
MarkNativeAsOptional("Test_Z");
}
#endif
z.sp
PHP Code:
#include <z>
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
CreateNative("Test_Z", Native_Z);
return APLRes_Success;
}
public int Native_Z(Handle plugin, int numParams)
{
return 0;
}
public void OnClientPostAdminCheck(int client)
{
int z = Test_Z();
}
Any other plugin now can use the Test_Z native as long as its included
zz.sp
PHP Code:
#include <z>
public void OnClientPutInServer(int client)
{
int z = Test_Z();
}