Raised This Month: $51 Target: $400
 12% 

How can make a include file with this native


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 05-16-2019 , 03:21   How can make a include file with this native
Reply With Quote #1

Sorry guys i am beginner ... Can put here a little example how can make to work?


I have this native
Code:
public plugin_natives()
{
    register_library("knife_duels")
    register_native("is_user_in_duel","_is_user_in_duel")
}

public _is_user_in_duel(index)
{
    new id = get_param(1)
    if(!is_user_connected(id))
        return PLUGIN_CONTINUE
    if(is_in_duel[id] == 2)
        return PLUGIN_HANDLED
    return PLUGIN_CONTINUE
}
include

Code:
#if defined _knife_duels_included
  #endinput
#endif
#define _knife_duels_included

native _is_user_in_duel(index)
Plugin example
Code:
#include <knife_duels>

public plugin_connect(id)
{
    if(is_in_duel[id] == 2)
    {
        // something
    }
}
Saint Sinner is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-16-2019 , 03:37   Re: How can make a include file with this native
Reply With Quote #2

This should be inside the include

PHP Code:
#if defined _knife_duels_included
  #endinput
#endif
#define _knife_duels_included

native is_user_in_duel(index); 
And in the example plugin

PHP Code:
#include <knife_duels>

public plugin_connect(id)
{
    if(
is_user_in_duel(id))
    {
        
// something
    
}

Notice PLUGIN_CONTINUE, PLUGIN_HANDLED

Are constants 1st equal to 0 and 2th equal to 1
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 05-16-2019 at 03:39.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 05-16-2019 , 07:03   Re: How can make a include file with this native
Reply With Quote #3

thanks !

But this native where can put becouse i have 2 plugins ? or not need them anymore? Or en the plugin base?

public plugin_natives()
{
register_library("knife_duels")
register_native("is_user_in_duel","_is_user_i n_duel")
}

Last edited by Saint Sinner; 05-16-2019 at 07:05.
Saint Sinner is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 05-16-2019 , 07:44   Re: How can make a include file with this native
Reply With Quote #4

if you are using two plugins only (one is reading (using native) from another) then i dont see a advantage of using .include file...about your last post..put that plugin_natives in 'main' plugin and in second plugin use
Code:
native is_user_in_duel( id )
above plugin_init()
or i missunderstood what you need
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 05-16-2019 , 08:21   Re: How can make a include file with this native
Reply With Quote #5

ok thanks
Saint Sinner is offline
Reply



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 12:04.


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