Код:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define PLUGIN "AntiFlash"
#define VERSION "1.0"
#define AUTHOR "CrAsH"
new g_PlayerFlasher
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("ScreenFade", "CheckFlash", "be", "4=255", "5=255", "6=255", "7>199")
register_event("23", "RemoveFlasher", "a", "1=5", "6=25", "7=6")
register_forward(FM_SetModel, "CheckFlasher")
}
public CheckFlash(id)
{
if(get_user_team(id) == get_user_team(g_PlayerFlasher))
{
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0, 0, 0}, id)
write_short(1)
write_short(1)
write_short(1)
write_byte(0)
write_byte(0)
write_byte(0)
write_byte(255)
message_end()
}
}
public RemoveFlasher()
{
set_task(0.05,"ResetFlasher")
return PLUGIN_CONTINUE
}
public ResetFlasher()
{
g_PlayerFlasher = 0
}
public SetFlasher(id)
{
g_PlayerFlasher = id - 12345
}
public CheckFlasher(iEntity, szModel[])
{
if(!equal(szModel, "models/w_flashbang.mdl"))
return FMRES_IGNORED
new iOwner = pev(iEntity, pev_owner)
if(iOwner == 0)
return FMRES_IGNORED
set_task(1.52, "SetFlasher", iOwner + 12345)
return FMRES_IGNORED
}