Raised This Month: $ Target: $400
 0% 

Register_Native


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-26-2018 , 12:08   Register_Native
Reply With Quote #1

Hey friends,
I am making a native plugin for using commands simply.
How can I make plugin more optimized? I don't want to use style 1. It's not recommended.
Waiting for your help

Native plugin (will work in server)
PHP Code:

// new bool:g_unammocuk[33] // will give players unammo.

public plugin_natives()
{
    
register_library("np");

    
register_native("np_set_user_unammo""native_set_user_unammo");
    
register_native("np_get_user_unammo""native_get_user_unammo"1);
    
register_native("np_set_user_rendering""native_set_user_rendering");
}

public 
native_set_user_unammo(indexunammo 0)
{
    new 
id get_param(1);

    if(!
id)
    {
        
set_fail_state("Error not found player.");
        return 
1;
    }

    
g_unammocuk[id] = unammo == false:true;
    return 
1;
}

public 
native_get_user_unammo(index)
{
    new 
id get_param(1);

    if(!
id)
    {
        
set_fail_state("Error not found player.");
        return 
1;
    }

    return 
g_unammocuk[id] ? true:false;
}

public 
native_set_user_rendering(indexfx kRenderFxNone, {Float,_}:color[3] = {0.0,0.0,0.0}, render kRenderNormalFloat:amount 0.0)
{
    new 
id get_param(1);
    new 
fx_id get_param(2);
    new 
Float:color_id get_param(3);
    new 
render_id get_param(4);
    new 
Float:amount_id get_param(5);

    if(!
id)
    {
        
set_fail_state("set_user_rendering user bulunamadi.");
        return 
1;
    }

    
set_entvar(idvar_renderfxfx_id fx_id:kRenderFxNone);
    
set_entvar(idvar_rendercolorcolor_id color_id:{0.0,0.0,0.0});
    
set_entvar(idvar_rendermoderender_id render_id:kRenderNormal);
    
set_entvar(idvar_renderamtamount_id amount_id:0.0);
    return 
1;

Np.inc
PHP Code:
#pragma reqlib "np"

/*
* Enable/Disable player's unammo skill.
*
* @param index            Client index
* @param unammo        To enable unammo
*
* @return        1 on success, 0 otherwise
*/

native np_set_user_unammo(const indexunammo 0)

/*
* Get the unammo of the player
*
* @param index            Client index
*
* @return        1 on success, 0 otherwise
*/

native np_get_user_unammo(const index)

native np_set_user_rendering(blabla// not finished enough 
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }


Last edited by PurposeLessx; 07-26-2018 at 12:13.
PurposeLessx is offline
 


Thread Tools
Display Modes

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:18.


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