Hi everybody, well i use this zombie class made by yokomo (leaper) work fine but can someone block the leap when zombies is in duck, I mean not use leap when is in duck only when standing... thx in advance
Code:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
new const zclass_name[] = {"Leap Zombie"}
new const zclass_info[] = {"Leap Ability"}
new const zclass_model[] = {"zombie_source"}
new const zclass_clawmodel[] = {"v_knife_zombie.mdl"}
const zclass_health = 4500
const zclass_speed = 269
const Float:zclass_gravity = 0.7
const Float:zclass_knockback = 1.3
new CvrLeapForward, CvrLeapUpward, CvrLeapCooldown, iZmClassLeaper, bool:bIsLeaper[33], Float:fLastLeap[33], iMaxClients
public plugin_precache()
{
iZmClassLeaper = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
}
public plugin_init()
{
register_plugin("ZP ZmClass Leaper", "0.0.1", "wbyokomo")
register_event("HLTV", "OnNewRound", "a", "1=0", "2=0")
RegisterHam(Ham_Killed, "player", "OnPlayerKilled")
RegisterHam(Ham_Player_Jump, "player", "OnPlayerJump")
CvrLeapForward = register_cvar("zp_class_leap_forward", "600")
CvrLeapUpward = register_cvar("zp_class_leap_upward", "300.0")
CvrLeapCooldown = register_cvar("zp_class_leap_cooldown", "5.0")
iMaxClients = get_maxplayers()
}
public OnNewRound()
{
new j
for(j=1;j<=iMaxClients;j++)
{
if(is_user_connected(j)) bIsLeaper[j] = false;
}
}
public OnPlayerKilled(id)
{
bIsLeaper[id] = false
}
public zp_user_infected_post(id)
{
bIsLeaper[id] = false
if(zp_get_user_nemesis(id)) return;
if(zp_get_user_zombie_class(id) != iZmClassLeaper) return;
bIsLeaper[id] = true
client_print(id, print_chat, "[ZP] Your ability is Long-Jump. Cooldown: %.1f secs.", get_pcvar_float(CvrLeapCooldown))
}
public zp_user_humanized_post(id)
{
bIsLeaper[id] = false
}
public OnPlayerJump(id)
{
if(!bIsLeaper[id]) return; //not a leaper zombie
static Float:ctime; ctime = get_gametime();
if(fLastLeap[id] > ctime) return; //in cooldown
if(pev(id, pev_maxspeed) < 2.0) return; //frozen or in freezetime
if(!(pev(id, pev_flags) & FL_ONGROUND)) return; //not on the ground
if(!(pev(id, pev_button) & IN_DUCK)) return; //not press duck button
//ok can leap
fLastLeap[id] = ctime+get_pcvar_float(CvrLeapCooldown)
new Float:fVelocity[3]
velocity_by_aim(id, get_pcvar_num(CvrLeapForward), fVelocity)
fVelocity[2] = get_pcvar_float(CvrLeapUpward)
set_pev(id, pev_velocity, fVelocity)
}