Raised This Month: $ Target: $400
 0% 

inc error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zombiesucker
BANNED
Join Date: Sep 2015
Location: Usa
Old 10-03-2015 , 09:45   Re: inc error
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <po_points>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /points""ShowPoints");
}

public 
ShowPoints(id)
{
    new 
iPoints po_get_user_points(id);
    
client_print(idprint_chat"You Have %i Total Points"iPoints);

there you go
zombiesucker is offline
Send a message via ICQ to zombiesucker Send a message via AIM to zombiesucker Send a message via Yahoo to zombiesucker Send a message via Skype™ to zombiesucker
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-03-2015 , 10:07   Re: inc error
Reply With Quote #2

This is not how you register a library.

PHP Code:
public plugin_natives()
{
    
register_library("po_points")
    
register_native("po_get_user_points""ShowPoints"1)

I don't see a working code for the other natives.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
zombiesucker
BANNED
Join Date: Sep 2015
Location: Usa
Old 10-03-2015 , 10:29   Re: inc error
Reply With Quote #3

Quote:
I don't see a working code for the other natives.
told you i made simple plugin

Last edited by zombiesucker; 10-03-2015 at 10:29.
zombiesucker is offline
Send a message via ICQ to zombiesucker Send a message via AIM to zombiesucker Send a message via Yahoo to zombiesucker Send a message via Skype™ to zombiesucker
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-03-2015 , 12:39   Re: inc error
Reply With Quote #4

You can't just make up function names, put them in an include file, and expect them to magically do stuff.

Where is the code for the po_get_user_points(id) function?
__________________
fysiks is offline
zombiesucker
BANNED
Join Date: Sep 2015
Location: Usa
Old 10-03-2015 , 13:33   Re: inc error
Reply With Quote #5

Quote:
Where is the code for the po_get_user_points(id) function?
code?
zombiesucker is offline
Send a message via ICQ to zombiesucker Send a message via AIM to zombiesucker Send a message via Yahoo to zombiesucker Send a message via Skype™ to zombiesucker
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-03-2015 , 14:41   Re: inc error
Reply With Quote #6

Quote:
Originally Posted by zombiesucker View Post
code?
Yeah. Where is the code for the natives? If you didn't write the code for these natives then where did you get the include file?
__________________
fysiks is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-03-2015 , 18:47   Re: inc error
Reply With Quote #7

Dude, try to focus.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 10-04-2015 , 05:51   Re: inc error
Reply With Quote #8

Everyone is helping you, but you ain't listening.

1. Create a "handler" for specific native in first plugin
2. Create a include
3. Create a second plugin that uses native
OvidiuS is offline
Send a message via Skype™ to OvidiuS
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-04-2015 , 06:54   Re: inc error
Reply With Quote #9

Fysiks, want you to show how you register the natives. As an example:

1. para_api.sma (The file which we register the natives):
Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

/*
HOW TO USE?
You need to add these 2 natives in your plugin.
native get_user_parachute(id) //to get whether player has parachute or not
native set_user_parachute(id, set=0) //to set whether player has parachute or not 1-Yes 0-No
*/

//fall speed must be in negative (float), lower mean more slower
#define FALL_SPEED -60.0
new bool:bHasParachute[33]

public plugin_natives()
{
    register_library("cs_para")
    register_native("get_user_parachute", "_get_user_parachute", 1)
    register_native("set_user_parachute", "_set_user_parachute", 1)
}

public plugin_init()
{
    register_plugin("Invisible Parachute API", "0.0.1", "wbyokomo")
    RegisterHam(Ham_Killed, "player", "OnPlayerKilled")
    register_forward(FM_CmdStart, "OnCmdStart")
}

public client_disconnect(id)
{
    bHasParachute[id] = false
}

public OnPlayerKilled(id)
{
    bHasParachute[id] = false
}

public OnCmdStart(id, uc_handle)
{
    if(!bHasParachute[id]) return;
    
    static button; button = get_uc(uc_handle, UC_Buttons);
    if(button & IN_USE)
    {
        static Float:fVelocity[3]; pev(id, pev_velocity, fVelocity);
        if(fVelocity[2] < 0.0)
        {
            fVelocity[2] = FALL_SPEED
            set_pev(id, pev_velocity, fVelocity)
        }
    }
}

public _get_user_parachute(id)
{
    return bHasParachute[id];
}

public _set_user_parachute(id, set)
{
    if(set > 0) bHasParachute[id] = true;
    else bHasParachute[id] = false;
}
2. cs_para.inc file:
Code:
#if defined _cs_para_included
    #endinput
#endif
#define _cs_para_included

#if AMXX_VERSION_NUM >= 175
    #pragma reqlib cs_para
    #if !defined AMXMODX_NOAUTOLOAD
        #pragma loadlib cs_para
    #endif
#else
    #pragma library cs_para
#endif

/****************************************************
*                    custom natives                 *
*****************************************************/

/**
 * param id - ID of client
 */
native get_user_parachute(id)
 
 
 /**
 * param id - ID of client
 */
native set_user_parachute(id, set=0)
3. test_plugin.sma file:
Code:
#include <amxmodx>
#include <hamsandwich>
#include <cs_para> // <---------------------- Your custom include

native zp_get_user_nemesis(id)
native zp_get_user_assassin(id)

public plugin_init()
{
    register_plugin("Free Parachute For All", "0.0.2", "wbyokomo")
    RegisterHam(Ham_Spawn, "player", "OnPlayerSpawnPost", 1)
}

public OnPlayerSpawnPost(id)
{
    //give parachute everytime player spawn
    if(!is_user_alive(id)) return;
    
    if(zp_get_user_nemesis(id) || zp_get_user_assassin(id)) set_user_parachute(id, 0); //nemesis & assassin no need parachute
    else set_user_parachute(id, 1); //give zombie/human parachute too
}

public zp_user_infected_post(id)
{
    if(!is_user_alive(id)) return;
    
    if(zp_get_user_nemesis(id) || zp_get_user_assassin(id)) set_user_parachute(id, 0); //nemesis & assassin no need parachute
    else set_user_parachute(id, 1); //give zombie parachute too
}

public zp_user_humanized_post(id)
{
    if(is_user_alive(id)) set_user_parachute(id, 1); //give parachute to human
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

Last edited by zmd94; 10-04-2015 at 06:55.
zmd94 is offline
zombiesucker
BANNED
Join Date: Sep 2015
Location: Usa
Old 10-04-2015 , 07:50   Re: inc error
Reply With Quote #10

thank you it work now

Last edited by zombiesucker; 10-04-2015 at 08:24.
zombiesucker is offline
Send a message via ICQ to zombiesucker Send a message via AIM to zombiesucker Send a message via Yahoo to zombiesucker Send a message via Skype™ to zombiesucker
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 22:04.


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