Участник
Пользователь
- Сообщения
- 272
- Реакции
- 14
Hi, I have some plugin, that will count kills and headshots like this https://prnt.sc/saaohvHi.
Anyone know of a plugin that displays this blinking sign for a few seconds after killing with HeadShoot?
#include <amxmodx>
#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif
#if !defined client_disconnected
#define client_disconnected client_disconnect
#endif
#define COUNTER_COLOR 0, 255, 0
#define COUNTER_POSITION -1.0, 0.1
const Float:COUNTER_REFRESH = 1.0
enum _:FragInfo { Frags, Headshots }
new g_iFrags[MAX_PLAYERS + 1][FragInfo], g_iSyncObj
public plugin_init()
{
register_plugin("Frag Counter", "1.0", "OciXCrom")
register_event("DeathMsg", "OnPlayerKilled", "a")
g_iSyncObj = CreateHudSyncObj()
}
public client_putinserver(id)
{
g_iFrags[id][Frags] = 0
g_iFrags[id][Headshots] = 0
set_task(COUNTER_REFRESH, "display_frags", id, .flags = "b")
}
public client_disconnected(id)
{
remove_task(id)
}
public display_frags(id)
{
if(is_user_alive(id))
{
set_hudmessage(COUNTER_COLOR, COUNTER_POSITION, .holdtime = COUNTER_REFRESH)
ShowSyncHudMsg(id, g_iSyncObj, "%i (%i HS)", g_iFrags[id][Frags], g_iFrags[id][Headshots])
}
}
public OnPlayerKilled()
{
new iAttacker = read_data(1)
if(is_user_connected(iAttacker) && iAttacker != read_data(2))
{
g_iFrags[iAttacker][Frags]++
if(read_data(3))
{
g_iFrags[iAttacker][Headshots]++
}
}
}
#include <amxmodx>
#include <reapi>
new const PLUGIN_NAME[] = "Icon headshot after killed";
new const PLUGIN_VERSION[] = "1.0";
new const PLUGIN_AUTHOR[] = "6u3oH";
new const ICON_NAME[] = "d_headshot"; // icon name
new const ICON_COLOR[] = { 128, 0, 255 }; // icon color { R, G, B }
const Float: ICON_SHOW_TIME = 2.5; // icon show time (seconds)
enum any:
{
STATUS_ICON_HIDE,
STATUS_ICON_SHOW,
STATUS_ICON_FLASH,
};
new g_iMsgStatusIconIndex;
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
RegisterHookChain(RG_CBasePlayer_Killed, "@CBasePlayer_Killed_Post", true);
g_iMsgStatusIconIndex = get_user_msgid("StatusIcon");
}
public client_disconnected(pPlayer)
{
remove_task(pPlayer);
}
@CBasePlayer_Killed_Post(pVictim, pKiller, iGib)
{
if(!is_user_connected(pKiller) || !get_member(pVictim, m_bHeadshotKilled))
return;
set_msg_status_icon(pKiller,
STATUS_ICON_SHOW,
ICON_NAME,
ICON_COLOR[0],
ICON_COLOR[1],
ICON_COLOR[2]
);
remove_task(pKiller);
set_task(ICON_SHOW_TIME, "@func_StatusIcon_Hide", pKiller);
}
@func_StatusIcon_Hide(pPlayer)
{
set_msg_status_icon(pPlayer,
STATUS_ICON_HIDE,
ICON_NAME,
0,
0,
0
);
}
stock set_msg_status_icon(pPlayer, iStatus, const sSpriteName[], iRed, iGreen, iBlue)
{
message_begin(MSG_ONE_UNRELIABLE, g_iMsgStatusIconIndex, .player = pPlayer);
write_byte(iStatus);
write_string(sSpriteName);
write_byte(iRed);
write_byte(iGreen);
write_byte(iBlue);
message_end();
}
#include <amxmodx>
#include <reapi>
new const PLUGIN_NAME[] = "Icon headshot after killed";
new const PLUGIN_VERSION[] = "1.0";
new const PLUGIN_AUTHOR[] = "6u3oH";
new const ICON_NAME[] = "d_headshot"; // icon name
new const ICON_COLOR[] = { 128, 0, 255 }; // icon color { R, G, B }
const Float: ICON_SHOW_TIME = 2.5; // icon show time (seconds)
enum any:
{
STATUS_ICON_HIDE,
STATUS_ICON_SHOW,
STATUS_ICON_FLASH,
};
new g_iMsgStatusIconIndex;
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "@CBasePlayer_OnSpawnEquip_Post", true);
RegisterHookChain(RG_CBasePlayer_Killed, "@CBasePlayer_Killed_Post", true);
g_iMsgStatusIconIndex = get_user_msgid("StatusIcon");
}
public client_disconnected(pPlayer)
{
remove_task(pPlayer);
}
@CBasePlayer_OnSpawnEquip_Post(pPlayer)
{
remove_task(pPlayer);
}
@CBasePlayer_Killed_Post(pVictim, pKiller, iGib)
{
if(!is_user_connected(pKiller) || !get_member(pVictim, m_bHeadshotKilled))
return;
@func_StatusIcon_Show(pKiller);
static
pPlayers[MAX_PLAYERS],
iPlayersCount;
get_players(pPlayers, iPlayersCount, "bh");
for(new i, pPlayer, pObserver; i < iPlayersCount; i++)
{
pPlayer = pPlayers[i];
pObserver = get_member(pPlayer, m_hObserverTarget);
if(is_user_connected(pObserver) && pKiller == pObserver && get_member(pObserver, m_iObserverLastMode) == OBS_ROAMING)
@func_StatusIcon_Show(pPlayer);
}
}
@func_StatusIcon_Show(pPlayer)
{
set_msg_status_icon(pPlayer,
STATUS_ICON_SHOW,
ICON_NAME,
ICON_COLOR[0],
ICON_COLOR[1],
ICON_COLOR[2]
);
remove_task(pPlayer);
set_task(ICON_SHOW_TIME, "@func_StatusIcon_Hide", pPlayer);
}
@func_StatusIcon_Hide(pPlayer)
{
set_msg_status_icon(pPlayer,
STATUS_ICON_HIDE,
ICON_NAME,
0,
0,
0
);
}
stock set_msg_status_icon(pPlayer, iStatus, const sSpriteName[], iRed, iGreen, iBlue)
{
message_begin(MSG_ONE_UNRELIABLE, g_iMsgStatusIconIndex, .player = pPlayer);
write_byte(iStatus);
write_string(sSpriteName);
write_byte(iRed);
write_byte(iGreen);
write_byte(iBlue);
message_end();
}