#include <amxmodx>
#include <fakemeta>
#include <reapi>
#define VIP_ACCESS ADMIN_LEVEL_H
#define TIME_FOR_INFO 5.0 // Время после смерти, через которое живые не услышат игрока
#if !defined MAX_PLAYERS
#define MAX_PLAYERS 32
#endif
#define is_user_vip(%0) (get_user_flags(%0) & VIP_ACCESS)
new bool:g_bBlockVoice[MAX_PLAYERS + 1];
new g_iUserAlive[MAX_PLAYERS + 1];
public plugin_init()
{
register_plugin("Time for info", "1.0", "neugomon | HARDCORE");
RegisterHookChain(RG_CBasePlayer_Spawn, "fwdPlayerSpawnPost", true);
RegisterHookChain(RG_CBasePlayer_Killed, "fwdPlayerKilledPost", true);
register_forward(FM_Voice_SetClientListening, "FwdSetClientListening", false);
}
public client_putinserver(id)
{
if(is_user_vip(id))
{
g_iUserAlive[id] = false;
g_bBlockVoice[id] = false;
}
else
{
g_iUserAlive[id] = false;
g_bBlockVoice[id] = true;
}
}
public fwdPlayerSpawnPost(id)
{
if(is_user_vip(id)) return;
g_iUserAlive[id] = is_user_alive(id);
if(g_iUserAlive[id])
g_bBlockVoice[id] = false;
}
public fwdPlayerKilledPost(const id)
{
if(is_user_vip(id)) return;
g_iUserAlive[id] = false;
g_bBlockVoice[id] = true;
g_iUserAlive[id] = 0;
set_hudmessage(0, 255, 0, -1.0, 0.20, 0, TIME_FOR_INFO);
show_hudmessage(id, "У вас 5 секунд чтоб дать Инфу!");
set_task(TIME_FOR_INFO, "BlockVoice", id);
}
public FwdSetClientListening(iReciever, iSender)
{
if(iSender != iReciever && g_bBlockVoice[iSender] && g_iUserAlive[iReciever])
{
engfunc(EngFunc_SetClientListening, iReciever, iSender, false);
forward_return(FMV_CELL, false);
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
public BlockVoice(id)
{
if(!g_iUserAlive[id])
{
g_bBlockVoice[id] = true;
set_hudmessage(.red = 255, .green = 69, .blue = 0, .x = -1.0, .y = 0.25, .holdtime = 10.0);
show_hudmessage(id, "Время для передачи инфы Истекло!^n Живые игроки больше не слышат Вас!");
}
}