The first one crashes your game because when the command scopedin is used it then triggers scopedout and that triggers scopedin again and that forms a loop and the game crashes. Some other stuff causes some problems as well though so I'd just create a toggle like JarateKing has so I'll just edit his script(just change xhUnscoped,xhScoped to the values you want like JarateKing has already mentioned):
alias xhUnscoped "cl_crosshair_file crosshair1"
alias xhScoped "cl_crosshair_file crosshair2"
alias scopedToggle "scopedToggleOn"
alias scopedToggleOn "xhScoped; alias scopedToggle scopedToggleOff"
alias scopedToggleOff "xhUnscoped; alias scopedToggle scopedToggleOn"
alias +attackswitch "scopedToggle;+attack2"
alias -attackswitch "-attack2"
bind mouse1 "+attack; spec_next; scopedToggleOff";
bind mouse2 "+attackswitch";
bind space "+jump; spec_mode; scopedToggleOff";
Anyways the reason why it didn't work before is because if you bind +attack2 to a key and before that you call an alias it basically keeps zooming in and out forever and if you use it after +attack2 the alias behind it triggers twice. That's why he also made a +jumpup command which I didn't use because it doesn't really matter if your crosshair gets changed to the none scoped in version twice or not. If you still wanted to use it it'd look like this:
alias xhUnscoped "cl_crosshair_file crosshair1"
alias xhScoped "cl_crosshair_file crosshair2"
alias scopedToggle "scopedToggleOn"
alias scopedToggleOn "xhScoped; alias scopedToggle scopedToggleOff"
alias scopedToggleOff "xhUnscoped; alias scopedToggle scopedToggleOn"
alias +attackswitch "scopedToggle;+attack2"
alias -attackswitch "-attack2"
alias +jumpup "+jump; +moveup"
alias -jumpup "-jump; -moveup"
bind mouse1 "+attack; spec_next; scopedToggleOff";
bind mouse2 "+attackswitch";
bind space "+jumpup; spec_mode; scopedToggleOff";