#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
/******************************************************
[Plugin infos]
******************************************************/
#define PLUGIN_NAME "[ZE] Zclass - Hunter"
#define PLUGIN_VERSION "0.2b"
#define PLUGIN_AUTHOR "DJHD!+snaker beatter"
/******************************************************
[Id(s)]
******************************************************/
// Zombie Attributes
new const zclass_name[] = "Zombi Hunter L4D"
new const zclass_info[] = "CTRL E ile Uzun Ziplar"
new const zclass_model[] = { "zpl_hunter" }
new const zclass_clawmodel[] = { "hunter.mdl" }
const zclass_speed = 290
const zclass_health = 15000
const Float:zclass_gravity = 0.6
const Float:zclass_knockback = 3.0
// Sounds
new const leap_sound[4][] = { "left_4_dead2/hunter_jump.wav", "left_4_dead2/hunter_jump1.wav", "left_4_dead2/hunter_jump2.wav", "left_4_dead2/hunter_jump3.wav" }
// Variables
new g_hunter, bool:g_b_isJumper[33]
// Arrays
new Float:g_lastleaptime[33]
// Cvar pointers
new cvar_force, cvar_cooldown
/******************************************************
[Main events] + [Precache event]
******************************************************/
public plugin_precache()
{
// Register the new class and store ID for reference
g_hunter = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
// Sound
static i
for(i = 0; i < sizeof leap_sound; i++)
precache_sound(leap_sound[i])
}
public plugin_init()
{
// Plugin Info
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
// Forward
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
// Cvars
cvar_force = register_cvar("zp_hunter_jump_force", "690")
cvar_cooldown = register_cvar("zp_hunter_jump_cooldown", "30.0")
static szCvar[30]
formatex(szCvar, charsmax(szCvar), "v%s by %s", PLUGIN_VERSION, PLUGIN_AUTHOR)
register_cvar("zp_zclass_hunterl4d2", szCvar, FCVAR_SERVER|FCVAR_SPONLY)
}
/******************************************************
[Events]
******************************************************/
public zp_user_infected_post(id, infector) // Infected post
{
// It's the selected zombie class
if(zp_get_user_zombie_class(id) == g_hunter)
{
if(zp_get_user_nemesis(id))
return
// Message
renkli_yazi(id, "!g[ZE]!t Yetenegin !gCTRL + E !tile uzun ziplamak.")
}
}
public fw_PlayerPreThink(id) // Main hunter command
{
if(!zp_get_user_zombie(id))
{
false_g_b_is_Jumper(id)
return
}
if(!is_user_alive(id))
{
false_g_b_is_Jumper(id)
return
}
if (zp_get_user_survivor(id))
{
false_g_b_is_Jumper(id)
return
}
if (zp_get_user_nemesis(id))
{
false_g_b_is_Jumper(id)
return
}
if(!is_user_alive(id))
return;
static iButton; iButton = pev(id, pev_button)
static iOldButton; iOldButton = pev(id, pev_oldbuttons)
if(zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_hunter) && !zp_get_user_nemesis(id))
{
if((iButton & IN_USE) && (iButton & IN_DUCK) && !(iOldButton & IN_USE))
ozelligiarttir(id)
}
}
public ozelligiarttir(id)
{
if (allowed_hunterjump(id))
{
new Float:velocity[3]
velocity_by_aim(id, get_pcvar_num(cvar_force), velocity)
set_pev(id, pev_velocity, velocity)
g_b_isJumper[id] = true
emit_sound(id, CHAN_STREAM, leap_sound[random_num(1, sizeof leap_sound -1)], 1.0, ATTN_NORM, 0, PITCH_HIGH)
// Set the current super jump time
g_lastleaptime[id] = get_gametime()
}
}
allowed_hunterjump(id) // Main function
{
if (g_b_isJumper[id])
{
if (!((pev(id, pev_flags) & FL_ONGROUND) && (pev(id, pev_flags) & FL_DUCKING)))
{
g_b_isJumper[id] = true
return false
}
static buttons
buttons = pev(id, pev_button)
// Not doing a longjump (added bot support)
if (!(buttons & IN_USE) && !is_user_bot(id))
{
g_b_isJumper[id] = true
return false
}
static Float:cooldown
cooldown = get_pcvar_float(cvar_cooldown)
if (get_gametime() - g_lastleaptime[id] < cooldown)
return false
}
return true
}
public false_g_b_is_Jumper(id) // Remove super jumps to human/survivor/nemesis
{
g_b_isJumper[id] = false
}
stock renkli_yazi(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, sizeof(msg) - 1, input, 3)
replace_all(msg, 190, "!n", "^x01")
replace_all(msg, 190, "!g", "^x04")
replace_all(msg, 190, "!t", "^x03")
if(id) players[0] = id; else get_players(players, count, "ch")
for(new i = 0; i < count; i++)
{
if(is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i])
write_string(msg)
message_end()
}
}
}