Не компилируется плагин, проблема с созданием натива..

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
5
Реакции
0
Ошибка
Skull-9.sma(68) : error 017: undefined symbol "id"
Skull-9.sma(68 -- 69) : warning 215: expression has no effect
Skull-9.sma(69) : error 017: undefined symbol "id"
Skull-9.sma(69 -- 70) : warning 215: expression has no effect
Skull-9.sma(74) : error 017: undefined symbol "id"
Skull-9.sma(74 -- 75) : warning 215: expression has no effect
Skull-9.sma(75) : error 017: undefined symbol "id"
Skull-9.sma(75 -- 76) : warning 215: expression has no effect
Компилятор
WEB-компилятор
Amx Mod X
1.9.0
Исходный код
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#include <xs>

#define NAME "Skull-9"
#define VERSION "1.0"
#define AUTHOR "ruslik1229"


#define KNIFE_NAME "skullaxe"
#define KNIFE_COST 10

#define KNIFE_GRAVITY 0.90
#define KNIFE_SPEED 280.0
#define SEC_DMG 3.0
#define PRIM_DMG 8.0
#define SEC_HEAD_DMG 6.0
#define PRIM_HEAD_DMG 14.0
#define KNIFE_KNOCK 9
#define BLOOD 8
#define ADMIN "0"

static const v_knife[] = "models/knife/v_skullaxe.mdl"
static const p_knife[] = "models/knife/p_skullaxe.mdl"

static const SoundList[][] =
{
"skullaxe/skullaxe_deploy1.wav", // 0
"skullaxe/skullaxe_hwall.wav", // 1
"skullaxe/skullaxe_slash1.wav", // 2
"skullaxe/skullaxe_stab.wav", // 3
"skullaxe/skullaxe1.wav", // 4
"skullaxe/skullaxe2.wav" // 5
}

static const Blood[][] =
{
"sprites/blood.spr",
"sprites/bloodspray.spr"
}
static g_Blood[sizeof Blood]
static g_Item_Knife
static bool:Knife[33]

public plugin_init()
{
register_plugin(NAME, VERSION, AUTHOR)

g_Item_Knife = zp_register_extra_item(KNIFE_NAME, KNIFE_COST, ZP_TEAM_HUMAN)

register_event("CurWeapon", "ChangeModel", "be", "1=1")
RegisterHam(Ham_TakeDamage, "player", "TakeDamage_Pre", 0)
RegisterHam(Ham_TakeDamage, "player", "TakeDamage_Post", 1)
RegisterHam(Ham_Player_PreThink, "player", "PreThink")
register_forward(FM_EmitSound, "KnifeSound")
}

public plugin_natives()
{
register_native("give_skull9", "give_skull9", 1);
register_native("remove_skull9", "remove_skull9", 1);
}

public give_skull9(player)
{
Knife[id] = true
change(id) = true
}

public remove_skull9(player)
{
Knife[id] = false
change(id) = false
}

public zp_user_infected_post(id) Knife[id] = false
public zp_extra_item_selected(id, itemid)
{
if(itemid == g_Item_Knife)
{ if(Knife[id]) return ZP_PLUGIN_HANDLED
new num = str_to_num(ADMIN)
if(num)
{
if(!is_user_admin(id))
return ZP_PLUGIN_HANDLED
}
engclient_cmd(id, "weapon_knife")
Knife[id] = true
change(id)
}
return PLUGIN_CONTINUE
}

public ChangeModel(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id))
return

static weaponid
weaponid = read_data(2)

if(!Knife[id] || weaponid != CSW_KNIFE)
return

change(id)
}

public KnifeSound(id, channel, sample[], Float:volume, Float:attn, flags, pitch)
{
if(!equal(sample, "weapons/knife_", 14) || !Knife[id])
return FMRES_IGNORED

if(equal(sample[8], "knife_hitwall", 13))
PlaySound(id, 1)
else
if(equal(sample[8], "knife_hit", 9))
switch(random(2))
{
case 0:PlaySound(id, 4)
case 1:PlaySound(id, 5)
}
if(equal(sample[8], "knife_slash", 11)) PlaySound(id, 2)
if(equal(sample[8], "knife_stab", 10)) PlaySound(id, 3)
if(equal(sample[8], "knife_deploy", 12)) PlaySound(id, 0)
return FMRES_SUPERCEDE
}

public TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damagetype)
{
if(!is_user_alive(attacker))
return HAM_IGNORED

if(!Knife[attacker] || get_user_weapon(attacker) != CSW_KNIFE)
return HAM_IGNORED

new hit, target
get_user_aiming(attacker, target, hit)

new bool:head = (hit == HIT_HEAD)
new Float:mult_dmg = 1.0
if(pev(attacker, pev_button, IN_ATTACK))
mult_dmg = head ? PRIM_HEAD_DMG : PRIM_DMG
else
mult_dmg = head ? SEC_HEAD_DMG : SEC_DMG
SetHamParamFloat(4, damage * mult_dmg)
return HAM_HANDLED
}

public TakeDamage_Post(victim, inflictor, attacker, Float:damage, damagetype)
{
if(!is_user_alive(attacker) || !is_user_alive(victim))
return HAM_IGNORED

if(!Knife[attacker] || get_user_weapon(attacker) != CSW_KNIFE)
return HAM_IGNORED

new Float:Origin[3], Float:Origin2[3], Float:Velocity[3]
pev(attacker, pev_origin, Origin)
pev(victim, pev_origin, Origin2)
xs_vec_sub(Origin2, Origin, Velocity)
xs_vec_normalize(Velocity, Velocity)
xs_vec_mul_scalar(Velocity, (KNIFE_KNOCK * 100.0), Velocity)
if(Velocity[2] <= 100.0)
Velocity[2] = random_float(150.0, 250.0)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BLOODSPRITE);
engfunc(EngFunc_WriteCoord, Origin2[0])
engfunc(EngFunc_WriteCoord, Origin2[1])
engfunc(EngFunc_WriteCoord, Origin2[2])
write_short(g_Blood[0])
write_short(g_Blood[1])
write_byte(77)
write_byte(BLOOD)
message_end()
set_pev(victim, pev_velocity, Velocity)
return HAM_HANDLED
}

public PreThink(id)
{
if(!is_user_alive(id)) return HAM_IGNORED
if(!Knife[id]) return HAM_IGNORED
if(get_user_weapon(id) != CSW_KNIFE)
{
set_pev(id, pev_gravity, get_cvar_float("zp_human_gravity"))
set_pev(id, pev_maxspeed, get_cvar_float("zp_human_speed"))
return HAM_IGNORED
}
set_pev(id, pev_gravity, KNIFE_GRAVITY)
set_pev(id, pev_maxspeed, KNIFE_SPEED)
return HAM_HANDLED
}

public plugin_precache()
{
precache_model(v_knife)
precache_model(p_knife)

static i
for(i = 0; i <= charsmax(SoundList); i++)
precache_sound(SoundList[i])

for(i = 0; i <= charsmax(Blood); i++)
g_Blood[i] = precache_model(Blood[i])
}

change(id)
{
set_pev(id, pev_viewmodel2, v_knife)
set_pev(id, pev_weaponmodel2, p_knife)
}

stock PlaySound(Ent, Sound)
engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, SoundList[_:Sound], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

stock is_user_admin(id)
{
new __flags=get_user_flags(id);
return (__flags>0 && !(__flags&ADMIN_USER));
}
В общем, создал нативы, чет башка не варит, че не так написал при удалений и созданий натива. Кто шарит прошу помочь
 
В этой теме было размещено решение! Перейти к решению.

fgd

Сообщения
92
Реакции
25
Помог
12 раз(а)
merkay, change(id) это функция, а ты пытаешься ему присвоить значение true.
Исправь:

C++:
public give_skull9(player)
{
    Knife[player] = true
    change(player);
}

public remove_skull9(player)
{
    Knife[player] = false
    change(player);
}
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу