Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define ACCESS_ADMIN ADMIN_LEVEL_A
/* hp_indicator */
#define HP_DEFAULT 0
#define HUD_CHANNEL 4
new hp_taken[33]
public plugin_init() {
register_plugin("KZ hp detection", "1.46", "p3tsin")
register_event("Damage", "damage_event", "b", "2!0")
register_cvar("amx_hpshow", "1")
register_cvar("amx_hpkick", "%d", HP_DEFAULT)
}
public damage_event() {
new id = read_data(0)
new health = get_user_health(id)
new dmg = read_data(2)
if(health > 255) {
new hpstring[24], null[1], rest[24]
format(hpstring,23, "%f", float(health) / 256.0)
strtok(hpstring, null,0, rest,23, '.', 1)
if(str_to_num(rest) == 0) set_user_health(id, health-1)
}
new hpkick = get_cvar_num("amx_hpkick")
if(get_cvar_num("amx_hpshow") && hpkick && dmg < 0) {
new hudmsg[256]
health = get_user_health(id)
format(hudmsg,255, "Damage inflicted: %d^nCurrent hp: %d", dmg, health)
set_hudmessage(255, 255, 255, 0.7, 0.8, 0, 0.0, 3.1, 0.1, 0.5, HUD_CHANNEL)
show_hudmessage(id, hudmsg)
hp_taken[id]++
if(hp_taken[id] >= hpkick)
server_cmd("kick #%d ^"Cant u read? Already got %dk hp^"", get_user_userid(id), health / 1000)
else {
if(task_exists(id)) remove_task(id)
set_task(10.0, "clear_hptakes", id)
}
}
}
public clear_hptakes(id) {
hp_taken[id] = 0
return PLUGIN_HANDLED
}
p3tsin used that code in his kz server. It shows the damage inflicted.