#include <amxmodx>
#include <reapi>
enum CVARS
{
Float:TEAM_TIME,
Float:OPPONENT_TIME
};
new g_eCvars[CVARS];
public plugin_init()
{
register_plugin("Blinding Time", "0.0.1", "Albertio");
RegisterHookChain(RG_PlayerBlind, "PlayerBlind_Pre");
bind_pcvar_float(create_cvar(
"bt_team_time",
"1.0",
FCVAR_NONE,
"Blinding time multiplier for teammates(to reduce the time, specify a value less than 1.0)"),
g_eCvars[TEAM_TIME]
);
bind_pcvar_float(create_cvar(
"bt_opponent_time",
"1.0",
FCVAR_NONE,
"Blinding time multiplier for opponents(to reduce the time, specify a value less than 1.0)"),
g_eCvars[OPPONENT_TIME]
);
AutoExecConfig(true, "blinding_time");
}
public PlayerBlind_Pre(const index, const inflictor, const attacker, const Float:fadeTime, const Float:fadeHold)
{
if(rg_is_player_can_takedamage(index, attacker))
{
SetHookChainArg(4, ATYPE_FLOAT, fadeTime * g_eCvars[OPPONENT_TIME]);
SetHookChainArg(5, ATYPE_FLOAT, fadeHold * g_eCvars[OPPONENT_TIME]);
}
else
{
SetHookChainArg(4, ATYPE_FLOAT, fadeTime * g_eCvars[TEAM_TIME]);
SetHookChainArg(5, ATYPE_FLOAT, fadeHold * g_eCvars[TEAM_TIME]);
}
}