I could be wrong, but I think kkun means that the gun barrel will oscillate between -45 and 45 degrees from the vertical until the user lets go the fire button, at which time the barrel freezes and the exploding sheep (or projectile of your choice

) can be pushed out in whatever direction that the barrel happens to be facing at the time
in which case a wrapvalue or bounce function to alter the barrel angle every loop would probably be necessary. Something like:
make object cylinder 1,1
scale object 1,1,30,1
sync on
sync rate 60
do
if spacekey()=1 and cycling = 0 then cycling = 1
if spacekey()=0 and cycling = 1
firing = 1
cycling = 0
endif
if cycling = 1
cycle=wrapvalue(cycle+1)
ang#=45*sin(cycle)
zrotate object 1,ang#
endif
`if firing = 1
`<insert firing code here>
`endif
sync
loop
*yes I know this rotates from the center of the 'barrel' but it illustrates the concept
when you want to fire, you can use the sx# and sy# calcs from van B's example, just make sure that you use the barrel object's zangle to calculate the projectile trajectory
This is not the Sig you are looking for....