Hi Can Somebody correct where i am wrong with this code iam trying to make that this zombie make sound when he dies misses gets pain and hits Here Is the Code:
Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#define PLUGIN "[ZP] Class: Hunter"
#define VERSION "1.2.2"
#define AUTHOR "YKH =]"
#define g_snd_
new const zclass_name[] = { "Hunter" }
new const zclass_info[] = { "Moka Leap" }
new const zclass_model[] = { "Hunter" }
new const zclass_clawmodel[] = { "models/v_Hunter_knife.mdl" }
const zclass_health = 200
const zclass_speed = 300
const Float:zclass_gravity = 0.8
const Float:zclass_knockback = 3.0
new const g_sound_miss[][] =
{
"L4D/Hunter_miss1.wav",
"L4D/Hunter_miss2.wav"
}
new const g_sound_hit[][] =
{
"L4D/Hunter_strike1.wav",
"L4D/Hunter_strike2.wav",
"L4D/Hunter_strike3.wav"
}
new const g_sound_pain[][] =
{
"L4D/Hunter_pain1.wav",
"L4D/Hunter_pain2.wav",
"L4D/Hunter_pain1.wav",
"L4D/Hunter_pain2.wav",
"L4D/Hunter_pain3.wav",
"L4D/Hunter_pain1.wav",
"L4D/Hunter_pain2.wav"
}
new const g_sound_die[][] =
{
"L4D/Hunter_die1.wav",
"L4D/Hunter_die2.wav",
"L4D/Hunter_die1.wav",
}
new g_zclass_LongJump, g_LongJump_force, g_LongJump_height, cvar_cooldown
new Float:g_lastleaptime[33] // time leap was last used
public plugin_init()
{
register_cvar("zp_zclass_leap_zombie",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
g_LongJump_force = register_cvar("zp_zclass_leap_force", "600")
g_LongJump_height = register_cvar("zp_zclass_leap_height", "245")
cvar_cooldown = register_cvar("zp_leap_cooldown", "1.5")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
}
public plugin_precache()
{
g_zclass_LongJump = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
new iNum
for (iNum = 0; iNum < sizeof g_sound_miss; iNum++)
engfunc(EngFunc_PrecacheSound, g_sound_miss[iNum])
for (iNum = 0; iNum < sizeof g_sound_hit; iNum++)
engfunc(EngFunc_PrecacheSound, g_sound_hit[iNum])
for (iNum = 0; iNum < sizeof g_sound_pain; iNum++)
engfunc(EngFunc_PrecacheSound, g_sound_pain[iNum])
for (iNum = 0; iNum < sizeof g_sound_die; iNum++)
engfunc(EngFunc_PrecacheSound, g_sound_die[iNum])
}
public zp_user_infected_post(player, infector)
{
if (zp_get_user_zombie_class(player) == g_zclass_LongJump)
{
client_print(player, print_chat, "[ZP] Duck and press E to use leap !")
}
return PLUGIN_CONTINUE
}
public fw_PlayerPreThink(id)
{
if (!is_user_alive(id))
return
if (allowed_LongJump(id))
{
static Float:velocity[3]
velocity_by_aim(id, get_pcvar_num(g_LongJump_force), velocity)
velocity[2] = get_pcvar_float(g_LongJump_height)
set_pev(id, pev_velocity, velocity)
// Set the current leap time
g_lastleaptime[id] = get_gametime()
}
}
allowed_LongJump(id)
{
if (!zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
return false
if (zp_get_user_zombie_class(id) != g_zclass_LongJump)
return false
if (!((pev(id, pev_flags) & FL_ONGROUND) && (pev(id, pev_flags) & FL_DUCKING)) || fm_get_speed(id) < 10)
return false
static buttons
buttons = pev(id, pev_button)
// Not doing a longjump (added bot support)
if (!(buttons & IN_USE) && !is_user_bot(id))
return false
// Get cooldown cvar
static Float:cooldown
cooldown = get_pcvar_float(cvar_cooldown)
// Cooldown not over yet
if (get_gametime() - g_lastleaptime[id] < cooldown)
return false
return true
}
stock fm_get_speed(entity)
{
static Float:velocity[3]
pev(entity, pev_velocity, velocity)
return floatround(vector_length(velocity));
}