Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#define Tag "[Bonus Health]"
static const PLUGIN_NAME[] = "-";
static const PLUGIN_AUTHOR[] = "-";
static const PLUGIN_VERSION[] = "1.0";
new sz_MapName[32];
new cStatus, cMaxHealth;
new cHeadshot, cKnifeHeadshot;
public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
cStatus = register_cvar("bonus_status", "1");
cMaxHealth = register_cvar("bonus_maxhealth", "100");
cHeadshot = register_cvar("bonus_headshot", "100");
cKnifeHeadshot = register_cvar("bonus_knifeheadshot", "100");
/* Player Killed */
register_event( "DeathMsg", "EventDeathMsg", "a", "1>0" );
}
/*
Bonus:
- Player Killed
*/
public EventDeathMsg() {
new killer = read_data(1);
new victim = read_data(2);
new headshot = read_data(3);
new weapon = get_user_weapon(killer);
new num;
if(killer == victim || !get_pcvar_num(cStatus) || !is_user_connected(victim) || !is_user_alive(killer))
return PLUGIN_HANDLED;
get_mapname( sz_MapName, charsmax( sz_MapName ) )
if( containi( sz_MapName, "ka_" ) == 0 )
if(headshot && weapon == CSW_KNIFE) {
num = get_pcvar_num(cKnifeHeadshot)
GiveHealth(killer, num)
HudMessage(killer, "Healed +%ihp", num)
} else if(headshot) {
num = get_pcvar_num(cHeadshot)
GiveHealth(killer, num)
HudMessage(killer, "Healed +%ihp", num)
}
return PLUGIN_CONTINUE;
}
GiveHealth(id, count)
set_user_health(id, min( (get_user_health(id) + count), get_pcvar_num(cMaxHealth) ))
stock HudMessage(const id, const input[], any:...) {
static msg[191];
vformat(msg, 190, input, 3);
set_hudmessage(127, 170, 255, 0.27, 0.14, 0, 5.0, 5.0, 0.0, 0.0, -1);
show_hudmessage(id, "%s^n%s", Tag, msg)
}