Raised This Month: $ Target: $400
 0% 

Register and Use Native in the Same Plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-07-2010 , 07:46   Register and Use Native in the Same Plugin
Reply With Quote #1

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(Client9999);
}
 
public 
_Test(ClientArgument)
{
        
// 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?
__________________
hleV is offline
 



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 07:17.


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