How does Heli attack do this?

Hey i have some questions which i know for a fact that some1 in this community can answer.

How does heli attack make it so that the gun always faces the direction of the cursor and how do they make it that when a heli gets blown up that another one duplicates?

If you know the script please tell me.

If you want to play heli attack and you havent click here: http://www.miniclip.com/heli2.htm