After a while studying other people's zoom scripts, and with a little help from MeatROme, I managed to come up with a 3-level zoom activated by the middle mouse button. It scrolls you through two levels of zoom, both of which change the crosshair size and take the gun off the screen.
It's also set to play sounds zoom.wav and zoomend.wav (which aren't included, but you can add custom ones)
Have fun sniping.
Update: If you weapon switch while zoomed it'll unzoom.