#include <amxmodx>
#include <gamecms5>
#include <gamecms_present>
#include <fakemeta_util>
new cpMaxHealth;
const PresentIdDeathHealth = 10;
new ModelDeathHealthPath[]= "../valve/models/w_medkit.mdl";
public OnPresentCoreStopped()
pause("d");
public plugin_init()
set_cvar_num("cms_presents_std", 0);
public plugin_cfg()
{
cpMaxHealth = get_cvar_pointer("cms_present_maxhealth");
new tmpName[128];
formatex(tmpName, charsmax(tmpName), "%L", LANG_PLAYER, "CMS_PRESENT_STD_HP");
CmsAddPresent(4, tmpName, -1, ACCESS_ALL, _, "models/present/syndyk1.mdl");
if(CmsAddPresent(PresentIdDeathHealth, "монета", -2, 0, 0, /*"exp2_blue"*/ModelDeathHealthPath, 0))
register_event("DeathMsg", "EventDeathMessage", "a");
}
public EventDeathMessage(killer, victim)
{
new killer = read_data(1);
new victim = read_data(2);
if(killer == victim)
return;
new Float:origin[3], sorigin[3]
get_user_origin(victim, sorigin, 0)
origin[0] = float(sorigin[0]);
origin[1] = float(sorigin[1]);
origin[2] = float(sorigin[2]);
CmsSpawnPresentById(PresentIdDeathHealth, origin, true, 0, 15.0)
}
public OnTakePresent(id, itemId)
{
switch(itemId)
{
case 4:
{
fm_set_user_health(id, min(get_user_health(id) + 40, get_pcvar_num(cpMaxHealth)));
client_cmd(0, "spk ^"buttons/bell1^"");
return PLUGIN_HANDLED;
}
case PresentIdDeathHealth:
{
fm_set_user_health(id, min(get_user_health(id) + 20, get_pcvar_num(cpMaxHealth)));
client_cmd(0, "spk ^"buttons/bell1^"");
return TP_GRANTED_STD_MESAGE_RESTRICT;
}
}
return PLUGIN_CONTINUE;
}