#include <amxmodx>
#include <hamsandwich>
#include <reapi>
new g_iHudSyncMessage;
public plugin_init()
{
register_plugin("Bomb Scenario Notification", "0.1", "Emma Jule");
if (!get_member_game(m_bMapHasBombTarget))
pause("ad");
g_iHudSyncMessage = CreateHudSyncObj();
RegisterHam(Ham_Think, "grenade", "CGrenade_C4Think", true);
}
public CGrenade_C4Think(const id)
{
if (!get_member(id, m_Grenade_bIsC4))
return;
new timeleft = floatround(Float:get_member(id, m_Grenade_flC4Blow) - get_gametime(), floatround_floor);
if (timeleft > 0 && timeleft % 5 == 0)
UTIL_Alert("CT", "Необходимо разминировать ПАЧКУ!^nПоторопитесь!");
}
UTIL_Alert(const szTeam[], szText[])
{
new aPlayers[32], iCount, pPlayer;
get_players(aPlayers, iCount, "ace", szTeam);
while (--iCount >= 0)
{
pPlayer = aPlayers[iCount];
UTIL_ScreenFade(pPlayer, 0.25, .color = { 0, 0, 75 });
set_hudmessage(0, 255, 0, -1.0, 0.35, 0, 0.0, 1.25, 0.0, 0.0);
ShowSyncHudMsg(pPlayer, g_iHudSyncMessage, "%s", szText);
}
}
const UNIT_SECOND = (1 << 12);
const FFADE_IN = 0x0000;
stock UTIL_ScreenFade(const id, const Float:fxtime = 0.75, const Float:holdtime = 0.15, const color[3] = { 150, 0, 0 }, const alpha = 100)
{
if (rg_is_user_blind(id))
return;
static iMsgScreenFade;
if (iMsgScreenFade > 0 || (iMsgScreenFade = get_user_msgid("ScreenFade")) > 0)
{
message_begin(MSG_ONE_UNRELIABLE, iMsgScreenFade, .player = id);
write_short(clamp(floatround(fxtime * UNIT_SECOND), 0, 0xFFFF));
write_short(clamp(floatround(holdtime * UNIT_SECOND), 0, 0xFFFF));
write_short(FFADE_IN);
write_byte(color[0]);
write_byte(color[1]);
write_byte(color[2]);
write_byte(alpha);
message_end();
}
}
stock Float:rg_get_remaining_time()
{
return (float(get_member_game(m_iRoundTimeSecs)) - get_gametime() + Float: get_member_game(m_fRoundStartTimeReal));
}
stock bool:rg_is_user_blind(const id)
{
return bool:(Float:get_member(id, m_blindUntilTime) > get_gametime());
}