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 }
*/