#include <amxmodx>
#include <reapi>
#define is_player(%0) (1 <= %0 <= MaxClients)
enum _:RGB { any:R, any:G, any:B }
new g_iMsgID_StatusIcon
new g_iKillStreak[MAX_PLAYERS + 1]
public plugin_init() {
register_plugin("Frags Counter", "1.0", "CHEL74")
RegisterHookChain(RG_CBasePlayer_Spawn, "Spawn_Post", true)
RegisterHookChain(RG_CBasePlayer_Killed, "Killed_Pre")
g_iMsgID_StatusIcon = get_user_msgid("StatusIcon")
}
public Spawn_Post(pPlayer) {
g_iKillStreak[pPlayer] = 0
}
public Killed_Pre(pVictim, pKiller) {
if(pVictim == pKiller || !is_player(pKiller)) {
return
}
static const szSprites[][] = {
"number_1",
"number_2",
"number_3",
"number_4",
"number_5",
"number_6",
"number_7",
"number_8",
"number_9"
}
static const iRGB[][RGB] = {
{ 0, 225, 0 },
{ 50, 225, 0 },
{ 100, 225, 0 },
{ 150, 225, 0 },
{ 200, 225, 0 },
{ 225, 200, 0 },
{ 225, 150, 0 },
{ 225, 100, 0 },
{ 225, 50, 0 }
}
new iKillsNum = g_iKillStreak[pKiller]
if(0 < iKillsNum < 10) {
message_begin(MSG_ONE, g_iMsgID_StatusIcon, _, pKiller)
write_byte(0)
write_string(szSprites[iKillsNum - 1])
message_end()
}
iKillsNum = ++g_iKillStreak[pKiller]
message_begin(MSG_ONE, g_iMsgID_StatusIcon, _, pKiller)
write_byte(1)
if(iKillsNum < 10) {
write_string(szSprites[iKillsNum - 1])
write_byte(iRGB[iKillsNum - 1][R])
write_byte(iRGB[iKillsNum - 1][G])
}
else {
write_string("dmg_heat")
write_byte(225)
write_byte(0)
}
write_byte(0)
message_end()
}