Hey guys,I want to display a icon (dmg_bio) when human become a zombie,and I try to add it to the sma,it is work.But the problem is: when I become a human,the icon still will exists and never disappears,please help!
PHP Code:
#include <amxmodx> #include <xs> #include <fakemeta> #include <hamsandwich> #include <zombieplague> #define SUPPORT_BOT_TO_USE new const zclass_name[] = { "Zombie Class: Healer" } new const zclass_info[] = { "=Press 'R' to heal=" } new const zclass_model[] = { "zombie_healer" } new const zclass_clawmodel[] = { "v_knife_healer.mdl" } const zclass_health = 5000 const zclass_speed = 240 const Float:zclass_gravity = 1.0 const Float:zclass_knockback = 1.0 new const HealSound[] = { "zombie_plague/td_debuff.wav" } new g_zclass_kuca new kuca_skill_cooldown, kuca_skill_range, kuca_skill_heal_point new Float:eyes_skill[33] new heal_spr public plugin_init() { register_plugin("[ZP] Class: Healer", "1.0", "I don't know")
replace_all(msg, 190, "!g", "^4") // Green Color replace_all(msg, 190, "!y", "^1") // Default Color replace_all(msg, 190, "!team", "^3") // Team Color replace_all(msg, 190, "!team2", "^0") // Team2 Color
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(); } } } } public zp_user_infected_post(id, infector) { if (zp_get_user_zombie_class(id) == g_zclass_kuca) { set_hud_spr(id,1) ChatColor(id, "!g[Zombie Healer]!yPress 'R' to heal yourself and teamates!Healing Range: %.1f,Restore HP: %d%,Cooldowng Time: %.1f.", get_pcvar_float(kuca_skill_range), get_pcvar_num(kuca_skill_heal_point), get_pcvar_float(kuca_skill_cooldown)) } } set_hud_spr(id,status) { message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("StatusIcon"),{0,0,0},id); write_byte(status); // status (0=hide, 1=show, 2=flash) write_string("dmg_bio"); // sprite name write_byte(0); // red write_byte(255); // green write_byte(0); // blue message_end(); } public zp_user_humanized_post(id) { clear(id) } public Death() { new id = read_data(2) clear(id) } public NewRound(id) { clear(id) } public client_connect(id) { clear(id) } public client_disconnect(id) { clear(id) } public clear(id) { eyes_skill[id] = 0.0 } public fw_CmdStart(id, uc_handle, seed) { if (!is_user_alive(id)) return FMRES_IGNORED;
if (!zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_kuca) return FMRES_IGNORED;
if (zp_get_user_nemesis(id)) return FMRES_IGNORED;
if ((button & IN_RELOAD) && !(oldbutton & IN_RELOAD)) { if (get_gametime() - eyes_skill[id] < get_pcvar_float(kuca_skill_cooldown)) { ChatColor(id, "!g[Zpmbie Healer]!yDuring the cooldown...") return FMRES_IGNORED; }
for(i = 1; i <= get_playersnum(); i++) if(id != i && is_user_alive(i) && zp_get_user_zombie(i) && !zp_get_user_nemesis(i)) if (is_in_view(id, i) && get_range(id, i) <= get_pcvar_float(kuca_skill_range)) heal_zombie(i) heal_zombie(id) eyes_skill[id] = get_gametime() }
#if defined SUPPORT_BOT_TO_USE if (is_user_bot(id)) { if (get_gametime() - eyes_skill[id] < get_pcvar_float(kuca_skill_cooldown)) return FMRES_IGNORED;
static bool:need_heal_in_view[33] for(i = 1; i <= get_playersnum(); i++) if(id != i && is_user_alive(i) && zp_get_user_zombie(i) && !zp_get_user_nemesis(i)) if (pev(i, pev_health) <= float(zp_get_zombie_maxhealth(i))*(100-get_pcvar_float(kuca_skill_heal_point))/100) if (is_in_view(id, i) && get_range(id, i) <= get_pcvar_float(kuca_skill_range)) need_heal_in_view[id] = true
return FMRES_HANDLED; } public heal_zombie(id) { show_spr(id) engfunc(EngFunc_EmitSound, id, CHAN_AUTO, HealSound, 1.0, ATTN_NORM, 0, PITCH_NORM) if (pev(id, pev_health) < float(zp_get_zombie_maxhealth(id))) set_pev(id, pev_health, floatmin(pev(id, pev_health) + float(zp_get_zombie_maxhealth(id))*get_pcvar_float(kuca_skill_heal_point)/100, float(zp_get_zombie_maxhealth(id)))) } public fw_PlayerPreThink(id) { if (!is_user_alive(id)) return FMRES_IGNORED;
if (zp_get_user_nemesis(id)) return FMRES_IGNORED;
if (!zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_kuca) return FMRES_IGNORED;
if (get_gametime() - eyes_skill[id] >= get_pcvar_float(kuca_skill_cooldown) && get_gametime() - eyes_skill[id] < get_pcvar_float(kuca_skill_cooldown)+0.1) ChatColor(id, "!g[Zombie Healer]!yNow you can use your skill again!")