| Doc-Holiday |
11-08-2009 14:48 |
Re: leap dont work
Quote:
Originally Posted by Akatsuki
(Post 984137)
Hey when i becoume a hunter leap dont work its on biohazard
|
Please post code in the php and /php tags
All i changed was the tags no code... its easier to read.
PHP Code:
#include <amxmodx> #include <fakemeta> #include <biohazard>
#define PLUGIN "bio_hunterzom" #define VERSION "1.1" #define AUTHOR "Akatsuki" #define STR_T 32 #define MAX_PLAYERS 32 #define D_ZOMBIE_NAME "Hunter" #define D_ZOMBIE_DESC "Can do leap"
new bool:g_hasLeap[33] new g_class new Float:g_last_LongJump_time[33] new g_LongJump_force, g_LongJump_height, g_LongJump_cooldown
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) is_biomod_active() ? plugin_init2() : pause("ad") }
public plugin_init2() { g_class = register_class(D_ZOMBIE_NAME, D_ZOMBIE_DESC) if(g_class != -1) { set_class_data(g_class, DATA_HEALTH, 260.0) set_class_data(g_class, DATA_SPEED, 350.0) set_class_data(g_class, DATA_REGENDLY, 0.05) } g_LongJump_force = register_cvar("bio_longjump_force", "550") g_LongJump_height = register_cvar("bio_longjump_height", "255") g_LongJump_cooldown = register_cvar("bio_longjump_cooldown", "5.0") register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
}
public event_infect(victim, attacker) { if (g_class != get_user_class(victim)) g_hasLeap[victim] = true return PLUGIN_CONTINUE }
public fw_PlayerPreThink(id) { if (!is_user_alive(id)) return FMRES_IGNORED if (g_class != get_user_class(id)) { g_hasLeap[id] = false } if (allow_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) g_last_LongJump_time[id] = get_gametime() } return FMRES_IGNORED }
// Check if the player can longjump allow_LongJump(id) { if (g_class != get_user_class(id)) return false if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80) return false static buttons buttons = pev(id, pev_button) if (!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK))) return false if (get_gametime() - g_last_LongJump_time[id] < get_pcvar_float(g_LongJump_cooldown)) return false return true }
// Get entity's speed (from fakemeta_util) stock fm_get_speed(entity) { static Float:velocity[3] pev(entity, pev_velocity, velocity) return floatround(vector_length(velocity)) }
|