#include < amxmodx >
#include < fakemeta_util >
 
#define RETURNFIGHT 1       			// Отдача выстрела - (1 - да) (0 - нет)
#define WIDTHCROSSHAIR 1  		// Расширение прицела - (1 - да) (0 - нет)
#define COLORCROSSHAIR "255 0 0"  	// Цвет прицела.
 
#if WIDTHCROSSHAIR == 1
        new iWidth[33]
#endif
 
public plugin_init() 
{
        register_forward(FM_PlaybackEvent, "fwPlaybackEvent")
        register_event("CurWeapon", "FwdWeapon", "be", "1=1");
}
 
public FwdWeapon(id)
{      
	new wp = read_data(2)
        if(wp == CSW_AWP && !iWidth[id] || wp == CSW_SCOUT && !iWidth[id] || wp == CSW_G3SG1 && !iWidth[id] || wp == CSW_SG550 && !iWidth[id] ) 
	{
		ShowHud(id, "|^n---  ---^n|")
	}
        else 
	{
		ShowHud(id)
 	}
        return PLUGIN_HANDLED;
}
 
public fwPlaybackEvent(flags, id, eventid, uc_handle)
{
        if(!is_user_connected(id) || is_user_bot(id))
        {
                return PLUGIN_HANDLED
        }
        
        new wp = get_user_weapon(id)
        if(wp == CSW_AWP || wp == CSW_SCOUT || wp == CSW_G3SG1 || wp == CSW_SG550 )
        {
                ShowHud(id, "|^n^n^n---    ---^n^n^n|")
                #if WIDTHCROSSHAIR == 1
                        remove_task(id)
                        set_task(0.1, "SetNormal", id)
                        iWidth[id] = 1
                #endif
                #if RETURNFIGHT == 1
                        ReturnFight(id, 150)
                #endif
        }
        else
	{
                ShowHud(id, "");
        }
        return PLUGIN_HANDLED;
}
 
#if WIDTHCROSSHAIR == 1
public SetNormal(id) 
{
        new wp = get_user_weapon(id)
        if(wp != CSW_AWP && wp != CSW_SCOUT && wp != CSW_G3SG1 && wp != CSW_SG550 )
	{
                return PLUGIN_CONTINUE
 	}
        switch(iWidth[id])
        {
                case 1: ShowHud(id, "|^n^n---   ---^n^n|"), iWidth[id]++
                case 2: ShowHud(id, "|^n---  ---^n|"), iWidth[id] = 0
        }
        if(iWidth[id])
	{
                set_task(0.1, "SetNormal", id)
        }
        return PLUGIN_HANDLED
}
#endif
 
#if RETURNFIGHT == 1
stock ReturnFight(id, iUnits)
{
        static Float:fVel[3]
        velocity_by_aim(id, -iUnits, fVel)
        fVel[2] += 100.0
        set_pev(id, pev_velocity, fVel)
        
        return 1;
}
#endif
 
stock ShowHud(id, const Message[] = "")
{
        new pos[4][4]
        parse(COLORCROSSHAIR, pos[1], 3, pos[2], 3, pos[3], 3)
        set_hudmessage(str_to_num(pos[1]),str_to_num(pos[2]),str_to_num(pos[3]), -1.0, -1.0, 0, 6.0, 300.0, 0.1, 0.2, 4);
        show_hudmessage(id, Message)
}