#include <amxmodx>
#include <fun>
new pMaxHP, pAddHP, pHsAddHP, pOnlyAdmins;
new AddHP, HsAddHP, MaxHP, oAdmins;
new g_HudSyncMsg;
new killer_HP, killerID;
new g_iAdmin[33];
public plugin_init()
{
#define Version "1.2"
register_plugin("Lite Vampire", Version, "neygomon");
register_cvar("lv_neygomon", Version, FCVAR_SERVER | FCVAR_SPONLY)
register_event("DeathMsg", "eDeathMsg", "a", "1>0");
pMaxHP = register_cvar("lv_maxhp", "100"); // Максимум HP
pAddHP = register_cvar("lv_addhp", "10"); // Добавление за убийство в тело
pHsAddHP = register_cvar("lv_hsaddhp", "15"); // Добавление за убийство в лицо :D
pOnlyAdmins = register_cvar("lv_oadmins", "0"); // Все функции плагина только для админов
g_HudSyncMsg = CreateHudSyncObj();
set_task(1.5, "Load_Cfg");
}
public Load_Cfg()
{
AddHP = get_pcvar_num(pAddHP);
HsAddHP = get_pcvar_num(pHsAddHP);
MaxHP = get_pcvar_num(pMaxHP);
oAdmins = get_pcvar_num(pOnlyAdmins);
}
public client_putinserver(id)
{
if(oAdmins)
{
if(get_user_flags(id) & ADMIN_MENU) g_iAdmin[id] = 1;
else g_iAdmin[id] = 0;
}
}
public eDeathMsg()
{
if(((killerID = read_data(1)) == read_data(2)) || (oAdmins && !g_iAdmin[killerID]))
return;
killer_HP = get_user_health(killerID);
static TempHP; TempHP = (read_data(3) == 1) ? HsAddHP : AddHP;
set_user_health(killerID, ((killer_HP += TempHP) > MaxHP) ? MaxHP : killer_HP);
set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1);
ShowSyncHudMsg(killerID, g_HudSyncMsg, "Добавлено +%d HP", TempHP);
}