Then you need to create it using "ent_create" (or place it inside the level and give it a function) and attach it to the camera at each frame.
To avoid "player-stucks-in-weapon-and-is-unable-to-move" situations:
- ignore_push for the player
or: - passable for the gun
To prevent the gun from "going-into-walls":
- znear flag for the gun
edit:
Please excuse my stupidity!
You can of course also use rel_to_screen and rel_for_screen:
http://manual.conitec.net/avec_rel_for_screen.htm