PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <fun>
#include <zombieplague>
#define PLUGIN "[ZP] Class - Necro"
#define VERSION "1.1"
#define AUTHOR "HoRRoR"
#define message_begin_f(%1,%2,%3) (engfunc (EngFunc_MessageBegin, %1, %2, %3))
#define write_coord_f(%1) (engfunc (EngFunc_WriteCoord, %1))
new const zclass_name[] = { "Zombie Necro" }
new const zclass_info[] = { "Revive Zombies Press F1" }
new const zclass_model[] = { "zombie_source" }
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const zclass_health = 3750
const zclass_speed = 240
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 1.5
new g_zclass_necro
new g_necro_respawn[33] = 1
new g_cooldown[33] = 0
new g_maxplayers
new i_cooldown_time[33] = 0
new g_nowshowed[33] = 0
enum Coord_e {Float:x, Float:y, Float:z};
// --- config ------------------------ //
#define COLOR_R 0
#define COLOR_G 255
#define COLOR_B 255
new Float:g_resp_cooldown = 60.0 //cooldown time
new g_must_infect_before_cast = 0 // set to 1, if you want, that zombie must infect someone to use spell. if 0 - zombie can cast if he spawn
new const sound_resurrection[] = "zombie_plague/spells/zombie_necro/Resurrection.wav" //respawn sound
new const sound_cast[] = "zombie_plague/spells/zombie_necro/Heal_Low_Base.wav" //cast sound
// ----------------------------------- //
public plugin_precache()
{
g_zclass_necro = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
precache_sound(sound_resurrection)
precache_sound(sound_cast)
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("ability1", "use_ability_one")
register_concmd("ability1", "use_ability_one")
g_maxplayers = get_maxplayers()
register_logevent("roundStart", 2, "1=Round_Start")
}
public roundStart()
{
for (new i = 1; i <= g_maxplayers; i++)
{
g_cooldown[i] = 0
i_cooldown_time[i] = floatround(g_resp_cooldown)
remove_task(i)
}
}
public use_ability_one(id)
{
if (is_user_alive(id) && (zp_get_user_zombie_class(id) == g_zclass_necro) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && (g_cooldown[id] == 0) && g_necro_respawn[id] == 0)
{
for (new i = 1; i <= g_maxplayers; i++)
{
if ((is_user_alive(i) == 0) && zp_get_user_zombie(i) && !zp_get_user_nemesis(i) && (g_necro_respawn[id] == 0))
{
zp_respawn_user(i, ZP_TEAM_ZOMBIE);
emit_sound(i, CHAN_STREAM, sound_resurrection, 1.0, ATTN_NORM, 0, PITCH_NORM);
static Coord_e:vecOrigin [Coord_e];
pev (i,pev_origin, vecOrigin);
message_begin_f (MSG_PVS, SVC_TEMPENTITY, vecOrigin, 0);
write_byte (TE_DLIGHT);
write_coord_f (vecOrigin [x ]);
write_coord_f (vecOrigin [y ]);
write_coord_f (vecOrigin [z ]);
write_byte (50); //light redius
write_byte (COLOR_R); //red
write_byte (COLOR_G); //green
write_byte (COLOR_B); //blue
write_byte (8);//life
write_byte (90);//decay
message_end();
}
}
g_necro_respawn[id] = 1
emit_sound(id, CHAN_STREAM, sound_cast, 1.0, ATTN_NORM, 0, PITCH_NORM);
i_cooldown_time[id] = floatround(g_resp_cooldown)
set_task(1.0, "ShowHUD", id, _, _, "a",i_cooldown_time[id])
set_task(g_resp_cooldown,"necro_ability_cooldown",id)
g_cooldown[id] = 1
g_nowshowed[id] = 0
}else if ((zp_get_user_zombie_class(id) == g_zclass_necro) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && (g_cooldown[id] == 0) && (g_necro_respawn[id] == 1))
{
if (is_user_alive(id))
{
new text[100]
format(text,99,"^x04[ZP]^x01 Your must infect someone to use your ability.")
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id)
write_byte(id)
write_string(text)
message_end()
}
}
}
public necro_ability_cooldown(id)
{
if ((zp_get_user_zombie_class(id) == g_zclass_necro) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{
g_cooldown[id] = 0
new text[100]
format(text,99,"^x04[ZP]^x01 Your ability ^x04Resurrection^x01 is ready.")
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id)
write_byte(id)
write_string(text)
message_end()
}
}
public ShowHUD(id)
{
if(is_user_alive(id))
{
i_cooldown_time[id] = i_cooldown_time[id] - 1;
set_hudmessage(200, 100, 0, 0.75, 0.92, 0, 1.0, 1.1, 0.0, 0.0, -1)
show_hudmessage(id, "Resurrection cooldown: %d",i_cooldown_time[id])
}else{
remove_task(id)
}
}
public zp_user_humanized_post(id)
{
remove_task(id)
}
public zp_user_infected_post(id, infector)
{
if ((zp_get_user_zombie_class(id) == g_zclass_necro) && !zp_get_user_nemesis(id))
{
new text[100]
new note_cooldown = floatround(g_resp_cooldown)
format(text,99,"^x04[ZP]^x01 Your ability is ^x04Resurrection^x01. Cooldown:^x04 %d ^x01seconds.",note_cooldown)
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id)
write_byte(id)
write_string(text)
message_end()
i_cooldown_time[id] = floatround(g_resp_cooldown)
remove_task(id)
g_necro_respawn[id] = g_must_infect_before_cast
g_cooldown[id] = 0
client_cmd(id,"bind F1 ability1")
}
if (zp_get_user_zombie_class(infector) == g_zclass_necro)
{
if (g_nowshowed[infector] == 0)
{
g_necro_respawn[infector] = 0
new text[100]
format(text,99,"^x04[ZP]^x01 Now you can use your ability.")
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},infector)
write_byte(infector)
write_string(text)
message_end()
g_nowshowed[infector] = 1
}
}
}