#include <amxmodx>
#include <reapi>
new const PLUGIN_NAME[] = "[ReAPI] Combo Damager";
new const PLUGIN_VERSION[] = "0.0.0";
#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32;
#endif
new Float: g_fTotalDamage[MAX_PLAYERS+1];
new g_HudSyncMessage;
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, "AddAnyAuthor");
RegisterHookChain(RG_CBasePlayer_TakeDamage, "CPlayer_TakeDamage_Post", .post = true);
RegisterHookChain(RG_CSGameRules_PlayerKilled, "CPlayer_Killed_Post", .post = true);
g_HudSyncMessage = CreateHudSyncObj();
}
public client_disconnected(iPlayer)
{
g_fTotalDamage[iPlayer] = 0.0;
}
public CPlayer_Killed_Post(iVictim, iKiller, iInflictor)
{
g_fTotalDamage[iVictim] = 0.0;
}
public CPlayer_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:flDamage, iBitsDamageType)
{
if(!is_user_connected(iAttacker) || flDamage <= 0.0 || !rg_is_player_can_takedamage(iVictim, iAttacker) || iVictim == iAttacker)
{
return;
}
if(iBitsDamageType & DMG_BLAST)
{
return;
}
g_fTotalDamage[iAttacker] += flDamage;
set_hudmessage(30, 114, 255, -1.0, 0.55, 0, 0.1, 2.5, 0.02, 0.02, -1);
ShowSyncHudMsg(iAttacker, g_HudSyncMessage, "%.0f [Комбо: %.0f]", flDamage, g_fTotalDamage[iAttacker]);
}