i was trying to close Scope zoom it works but there's a bug, when player shoot while opening Scope Scope opening automatically and dont close.
PHP Code:
public Fwd_PlayerPreThink(id)
{
if(!is_user_connected(id) || !is_user_alive(id))
return;
static Wpn, Temp, Button;
Wpn = get_user_weapon(id, Temp, Temp);
Button = pev(id, pev_button);
if(Wpn == CSW_AWP)
{
if((Button & IN_ATTACK2) && !Attack2Pressed[id])
{
set_task(0.5, "scope", id)
Attack2Pressed[id] = false;
}
else if((Button & (IN_ATTACK || IN_ATTACK2)) & Attack2Pressed[id])
{
cs_set_user_zoom(id, CS_RESET_ZOOM, 1);
Attack2Pressed[id] = true;
}
}
}
public scope(id){
cs_set_user_zoom(id, CS_RESET_ZOOM, 1);
return PLUGIN_HANDLED;
}