Code: Select all
/* Houndeye Zombie v0.4
By Morte
-. Description: Blast player and make it fly.
-. Cvars: zp_houndeye_timeblast 2.5 (Time to Blast)
zp_houndeye_radius 150.0 (Blast Radius)
zp_houndeye_infect_blast 0 (Blast infect players)
zp_houndeye_damage 0 (Blast Damage)
zp_houndeye_damage_amount 25 (Blast Damage Amount)
-. Changelog:
# 0.1 - Plugin Release
# 0.2 - Added 2 cvar's: 1) To activate the blast damage
2) To select the amount of the damage
# 0.3 - Now you can't use blast hability if you are nemesis.
# 0.4 - Fixed cvar "zp_houndeye_damage_amount".
-. Credits:
# shinoda - Help me with how to make players fly.
# MeRcyLeZZ - For his Zombie Plague ^.^
# frk_14 - For the model.
*/
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <xs>
#include <engine>
#include <zombieplague>
/*================================================================================
[Plugin Customization]
=================================================================================*/
new const zclass_name[] = { "Houndeye Zombie" }
new const zclass_info[] = { "Blast Power (Pressing E)" }
new const zclass_model[] = { "houndeye" }
new const zclass_clawmodel[] = { "v_houndeye.mdl" }
const zclass_health = 1000
const zclass_speed = 200
const Float:zclass_gravity = 0.6
const Float:zclass_knockback = 0.6
new const beam_cylinder[] = "sprites/white.spr"
new const houndeye_attack[][] = { "houndeye/he_attack1.wav", "houndeye/he_attack3.wav" }
new const houndeye_blast[][] = { "houndeye/he_blast1.wav", "houndeye/he_blast3.wav" }
/*================================================================================
[End Customization]
=================================================================================*/
#define is_player(%0) (1 <= %0 <= giMaxplayers)
#define TASK_BARTIME 16000
// Zombie vars
new gMsgBarTime, gMsgDeathMsg, gSprBeam, gHoundEye, giMaxplayers, cvar_timeblast, cvar_radius, cvar_blast_infect,
cvar_damage, cvar_damage_amount
public plugin_init()
{
register_plugin("Houndeye Zombie", "0.4", "Morte")
cvar_timeblast = register_cvar("zp_houndeye_timeblast", "2.5")
cvar_radius = register_cvar("zp_houndeye_radius", "150.0")
cvar_blast_infect = register_cvar("zp_houndeye_infect", "0")
cvar_damage = register_cvar("zp_houndeye_damage", "0")
cvar_damage_amount = register_cvar("zp_houndeye_damage_amount", "25")
register_forward( FM_CmdStart, "CmdStart")
giMaxplayers = get_maxplayers()
gMsgBarTime = get_user_msgid("BarTime")
gMsgDeathMsg = get_user_msgid("DeathMsg")
}
public plugin_precache()
{
gHoundEye = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
gSprBeam = precache_model(beam_cylinder)
for (new i = 0; i < sizeof houndeye_attack; i++)
engfunc(EngFunc_PrecacheSound, houndeye_attack[i])
for (new i = 0; i < sizeof houndeye_blast; i++)
engfunc(EngFunc_PrecacheSound, houndeye_blast[i])
}
public CmdStart(id)
{
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) == gHoundEye) && !zp_get_user_nemesis(id))
{
if( ( iButton & IN_USE ) && !( iOldButton & IN_USE ) )
{
if(!is_user_alive(id))
return;
message_begin(MSG_ONE, gMsgBarTime, _, id)
write_byte(get_pcvar_num(cvar_timeblast))
write_byte(0)
message_end()
emit_sound(id, CHAN_VOICE, houndeye_attack[random_num(0, sizeof houndeye_attack - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
set_task(get_pcvar_float(cvar_timeblast), "blast_players", id+TASK_BARTIME)
}
if( iOldButton & IN_USE && !( iButton & IN_USE ) )
set_task(0.1, "blast_stop", id)
}
}
public blast_stop(id)
{
message_begin(MSG_ONE, gMsgBarTime, _, id)
write_byte(0)
write_byte(0)
message_end()
remove_task(id+TASK_BARTIME)
}
public blast_players(id)
{
id -= TASK_BARTIME
new Float: iOrigin[3]
pev(id, pev_origin, iOrigin)
emit_sound(id, CHAN_VOICE, houndeye_blast[random_num(0, sizeof houndeye_blast - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, iOrigin, 0)
write_byte(TE_BEAMCYLINDER)
engfunc(EngFunc_WriteCoord, iOrigin[0])
engfunc(EngFunc_WriteCoord, iOrigin[1])
engfunc(EngFunc_WriteCoord, iOrigin[2])
engfunc(EngFunc_WriteCoord, iOrigin[0])
engfunc(EngFunc_WriteCoord, iOrigin[1])
engfunc(EngFunc_WriteCoord, iOrigin[2]+385.0)
write_short(gSprBeam)
write_byte(0)
write_byte(0)
write_byte(4)
write_byte(60)
write_byte(0)
write_byte(255)
write_byte(255)
write_byte(255)
write_byte(200)
write_byte(0)
message_end()
static Ent, Float: originF[3]
while( (Ent = engfunc(EngFunc_FindEntityInSphere, Ent, iOrigin, get_pcvar_float(cvar_radius))) )
{
if( is_player(Ent) && Ent != id )
{
if(zp_get_user_zombie(Ent) || zp_get_user_zombie(Ent))
return PLUGIN_CONTINUE;
if(get_pcvar_num(cvar_blast_infect))
{
zp_infect_user(Ent, 1)
SendDeathMsg(id, Ent)
}
if(get_pcvar_num(cvar_damage))
{
if(zp_get_user_survivor(Ent))
return PLUGIN_CONTINUE;
fm_set_user_health(Ent, pev(Ent, pev_health) - get_pcvar_num(cvar_damage_amount))
}
pev(Ent, pev_origin, originF)
originF[0] = (originF[0] - iOrigin[0]) * 10.0
originF[1] = (originF[1] - iOrigin[1]) * 10.0
originF[2] = (originF[2] - iOrigin[2]) + 500.0
set_pev(Ent, pev_velocity, originF)
}
}
return PLUGIN_HANDLED;
}
SendDeathMsg(attacker, victim)
{
message_begin(MSG_BROADCAST, gMsgDeathMsg)
write_byte(attacker)
write_byte(victim)
write_byte(1)
write_string("infection")
message_end()
}
/*================================================================================
[Stocks]
=================================================================================*/
stock print_chatColor(const id,const input[], any:...)
{
new msg[191], players[32], count = 1;
vformat(msg,190,input,3);
replace_all(msg,190,"!g","^4");// green
replace_all(msg,190,"!n","^1");// normal
replace_all(msg,190,"!t","^3");// team
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();
}
}
stock fm_set_user_health(id, health)
{
(health > 0) ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
*/