Please add max hp and ap check controllable by cvars (max_ap and max_hp)
PHP Code:
#include <amxmodx>
#include <fun>
#define PLUGIN "New Plug-In"
#define VERSION "0.1"
#define AUTHOR "asdf"
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
#define MAX_PLAYERS 32
new const Float:g_flCoords[][] =
{
{0.50, 0.40},
{0.56, 0.44},
{0.60, 0.50},
{0.56, 0.56},
{0.50, 0.60},
{0.44, 0.56},
{0.40, 0.50},
{0.44, 0.44}
}
new g_iPlayerPos[MAX_PLAYERS+1]
new g_iMaxPlayers
new g_pCvarEnabled
new msgScreenFade, amx_kill_fade_amount, csdm_hp, csdm_ap
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pCvarEnabled = register_cvar("bullet_damage", "1")
amx_kill_fade_amount = register_cvar("amx_kill_fade_amount", "150")
csdm_hp = register_cvar("csdm_hp", "15")
csdm_ap = register_cvar("csdm_ap", "15")
register_event("DeathMsg", "death_event", "a", "1>0")
register_event("Damage", "Event_Damage", "b", "2>0", "3=0")
g_iMaxPlayers = get_maxplayers()
msgScreenFade = get_user_msgid("ScreenFade")
g_iMaxPlayers = get_maxplayers()
}
public Event_Damage( iVictim )
{
if( get_pcvar_num(g_pCvarEnabled) && (read_data(4) || read_data(5) || read_data(6)) )
{
new id = get_user_attacker(iVictim)
if( (1 <= id <= g_iMaxPlayers) && is_user_connected(id) && get_user_flags(id) & ADMIN_LEVEL_H )
{
new iPos = ++g_iPlayerPos[id]
if( iPos == sizeof(g_flCoords) )
{
iPos = g_iPlayerPos[id] = 0
}
set_hudmessage(0, 40, 80, Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1)
show_hudmessage(id, "%d", read_data(2))
}
}
}
public death_event()
{
new iKiller = read_data(1)
if(IsPlayer(iKiller) && is_user_alive(iKiller) && get_user_flags(iKiller) & ADMIN_LEVEL_H)
{
fadegreen(iKiller, get_pcvar_num(amx_kill_fade_amount))
set_user_health(iKiller, get_user_health(iKiller) + get_pcvar_num(csdm_hp))
set_user_armor(iKiller, get_user_armor(iKiller) + get_pcvar_num(csdm_ap))
}
}
stock fadegreen(id, ammount)
{
//FADE OUT FROM GREEN
if (ammount > 255)
ammount = 255
message_begin(MSG_ONE_UNRELIABLE, msgScreenFade, {0,0,0}, id)
write_short(ammount * 100) //Durration
write_short(0) //Hold
write_short(0) //Type
write_byte(0) //R
write_byte(0) //G
write_byte(200) //B
write_byte(ammount) //B
message_end()
}