- Amx Mod X
- AMXX 1.9.0-dev
- Ошибка
-
Код:[HAMSANDWICH] Function playerspawn_post not found.
L 03/11/2019 - 06:29:27: [AMXX] Displaying debug trace (plugin "b_o_knife.amxx", version "unknown")
L 03/11/2019 - 06:29:27: [AMXX] Run time error 10: native error (native "RegisterHam")
L 03/11/2019 - 06:29:27: [AMXX] [0] b_o_knife.sma:lugin_init (line 16)
- Исходник
-
Код:#include <amxmodx>
#include <hamsandwich>
#include <reapi>
#define ACCESS_FLAG ADMIN_LEVEL_C // Флаг которому доступно оружие.
#define WEAPON_ID WEAPON_KNIFE
new const KN_V_MODEL[] = "models/custom/v_knife.mdl";
new const KN_P_MODEL[] = "models/custom/p_knife.mdl";
new const g_szWeaponName[] = "weapon_knife";
#define WEAPON_DAMAGE 2.0 // Множитель урона
#define WEAPON_UID 1
public plugin_init() {
RegisterHam(Ham_Spawn, "player", "playerspawn_post", 1);
RegisterHam(Ham_Item_Deploy, g_szWeaponName, "HookItemDeploy", 1);
}
public plugin_precache() {
precache_model(KN_V_MODEL);
precache_model(KN_P_MODEL);
}
public playerspawn_post(id)
{
#if defined ACCESS_FLAG
if (~get_user_flags(id) & ACCESS_FLAG) {
return PLUGIN_HANDLED;
}
#endif
if(!is_user_alive(id))
return PLUGIN_HANDLED;
new iWeapon = rg_give_custom_item(id, g_szWeaponName, GT_DROP_AND_REPLACE, WEAPON_UID);
if(is_nullent(iWeapon))
return PLUGIN_HANDLED;
#if defined WEAPON_DAMAGE
set_member(iWeapon, m_Weapon_flBaseDamage, Float:get_member(iWeapon, m_Weapon_flBaseDamage) * WEAPON_DAMAGE);
#if WEAPON_ID == WEAPON_M4A1
set_member(iWeapon, m_M4A1_flBaseDamageSil, Float:get_member(iWeapon, m_M4A1_flBaseDamageSil) * WEAPON_DAMAGE);
#elseif WEAPON_ID == WEAPON_USP
set_member(iWeapon, m_USP_flBaseDamageSil, Float:get_member(iWeapon, m_USP_flBaseDamageSil) * WEAPON_DAMAGE);
#elseif WEAPON_ID == WEAPON_FAMAS
set_member(iWeapon, m_Famas_flBaseDamageBurst, Float:get_member(iWeapon, m_Famas_flBaseDamageBurst) * WEAPON_DAMAGE);
#endif
#endif
return PLUGIN_HANDLED;
}
public HookItemDeploy(const weapon) {
if (get_entvar(weapon, var_impulse) == WEAPON_UID) {
new id = get_member(weapon, m_pPlayer);
set_entvar(id, var_viewmodel, KN_V_MODEL);
set_entvar(id, var_weaponmodel, KN_P_MODEL);
}
Компилируеться с предупреждением и не работает нож при подключению игрока. ошибка в 16 строке Все посмотрел вроде как.
Код:
#include <amxmodx>
#include <hamsandwich>
#include <reapi>
#define ACCESS_FLAG ADMIN_LEVEL_C // Флаг которому доступно оружие.
#define WEAPON_ID WEAPON_KNIFE
new const KN_V_MODEL[] = "models/custom/v_knife.mdl";
new const KN_P_MODEL[] = "models/custom/p_knife.mdl";
new const g_szWeaponName[] = "weapon_knife";
#define WEAPON_DAMAGE 2.0 // Множитель урона
#define WEAPON_UID 1
public plugin_init() {
RegisterHam(Ham_Spawn, "player", "playerspawn_post", 1);
RegisterHam(Ham_Item_Deploy, g_szWeaponName, "HookItemDeploy", 1);
}
public plugin_precache() {
precache_model(KN_V_MODEL);
precache_model(KN_P_MODEL);
}
public playerspawn_post(id)
{
#if defined ACCESS_FLAG
if (~get_user_flags(id) & ACCESS_FLAG) {
return PLUGIN_HANDLED;
}
#endif
if(!is_user_alive(id))
return PLUGIN_HANDLED;
new iWeapon = rg_give_custom_item(id, g_szWeaponName, GT_DROP_AND_REPLACE, WEAPON_UID);
if(is_nullent(iWeapon))
return PLUGIN_HANDLED;
#if defined WEAPON_DAMAGE
set_member(iWeapon, m_Weapon_flBaseDamage, Float:get_member(iWeapon, m_Weapon_flBaseDamage) * WEAPON_DAMAGE);
#if WEAPON_ID == WEAPON_M4A1
set_member(iWeapon, m_M4A1_flBaseDamageSil, Float:get_member(iWeapon, m_M4A1_flBaseDamageSil) * WEAPON_DAMAGE);
#elseif WEAPON_ID == WEAPON_USP
set_member(iWeapon, m_USP_flBaseDamageSil, Float:get_member(iWeapon, m_USP_flBaseDamageSil) * WEAPON_DAMAGE);
#elseif WEAPON_ID == WEAPON_FAMAS
set_member(iWeapon, m_Famas_flBaseDamageBurst, Float:get_member(iWeapon, m_Famas_flBaseDamageBurst) * WEAPON_DAMAGE);
#endif
#endif
return PLUGIN_HANDLED;
}
public HookItemDeploy(const weapon) {
if (get_entvar(weapon, var_impulse) == WEAPON_UID) {
new id = get_member(weapon, m_pPlayer);
set_entvar(id, var_viewmodel, KN_V_MODEL);
set_entvar(id, var_weaponmodel, KN_P_MODEL);
}
}
Вложения
-
7,8 KB Просмотры: 8