Код
#include <amxmodx>
#include <cstrike>
#include <fun>
#define PLUGIN_VERSION "1.1c"
new health_add
new health_hs_add
new health_max
new armor_add
new armor_hs_add
new armor_max
new nKiller
new nKiller_hp
new nHp_add
new nHp_max
new nKiller_ap
new nAp_add
new nAp_max
public plugin_init()
{
register_plugin("Vampire", PLUGIN_VERSION, "Shalfey")
health_add = register_cvar("amx_vampire_hp", "3")
health_hs_add = register_cvar("amx_vampire_hp_hs", "6")
health_max = register_cvar("amx_vampire_max_hp", "100")
armor_add = register_cvar("amx_vampire_ap", "15")
armor_hs_add = register_cvar("amx_vampire_ap_hs", "20")
armor_max = register_cvar("amx_vampire_max_ap", "100")
register_event("DeathMsg", "hook_death", "a", "1>0")
}
public hook_death()
{
// Killer id
nKiller = read_data(1)
if ( (read_data(3) == 1) && (read_data(5) == 0) )
{
nHp_add = get_pcvar_num (health_hs_add)
nAp_add = get_pcvar_num (armor_hs_add)
}
else
{
nHp_add = get_pcvar_num (health_add)
nAp_add = get_pcvar_num (armor_add)
}
nHp_max = get_pcvar_num (health_max)
nAp_max = get_pcvar_num (armor_max)
// Updating Killer HP & Armor
nKiller_hp = get_user_health(nKiller)
nKiller_hp += nHp_add
new CsArmorType:armortype
nKiller_ap = cs_get_user_armor(nKiller, armortype)
nKiller_ap += nAp_add
// Maximum HP check
if (nKiller_hp > nHp_max) nKiller_hp = nHp_max
if (nKiller_ap > nAp_max) nKiller_ap = nAp_max
set_user_health(nKiller, nKiller_hp)
cs_set_user_armor(nKiller, nKiller_ap, armortype)
// Hud message "Healed +15/+25 hp & +3/+5 ap"
set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
show_hudmessage(nKiller, "Healed +%d hp, +%d ap", nHp_add, nAp_add)
// Screen fading
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, nKiller)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(75)
message_end()
}