Hello. I'm using native with style 0 and I'm trying to use the native in the same plugin in which I registered it.
Include file
test.inc contains:
PHP Code:
#if defined TEST_INCLUDED
#endinput
#endif
#define TEST_INCLUDED;
#pragma library Test
native Test(Client);
Source file contains:
PHP Code:
#include <amxmodx>
#include <test>
public plugin_natives()
{
register_library("Test");
register_native("Test", "_Test");
}
public SomeFunction(Client)
{
// I want to use native Test()
// Can't use Test() since it doesn't exist yet
// so I'm going directly to native function
_Test(Client);
}
public _Test(Client)
{
// I'm using style 0, so I need to do this
// new Param = get_param(1);
Client = get_param(1);
// Stuff
}
So I'm doing this:
PHP Code:
public SomeFunction(Client)
{
// I'm adding an argument with a value of 9999
_Test(Client, 9999);
}
public _Test(Client, Argument)
{
// Now I'm checking if Argument's value is 9999
// If not - it's called as a native
// otherwise - it's called as a normal function from this plugin
if (Argument != 9999)
Client = get_param(1);
// Stuff
}
Is there a better method?
__________________