1: Import the .x model into fragmotion. There is a 99% chance that there will be an error with the model.
2: Flip the entire model on the z axis.
3: Export 2 Half-Life 2 SMD files, one for mesh and one for anims.
4: Download the .smd plugins for Max (GMax is also supported, but I've never tried).
5: Import idle01.smd from steam\steamapps\yourusername\sourcesdk_content\hl2\modelsrc\weapons\pistol (You must have Source SDK installed for this)
6: If successful, there should be no mesh and just bones. Rename all the bones to whatever, then import both the mesh and anim file for your weapon.
7: Reposition the weapon so it looks like it should be, based on the pistol bones.
8: Delete the pistol bones.
9: Open the FPSC gunspec file of what gun you chose. Then, find that pistol folder (or whatever gun you wish to replace) and remove it's "read only" attributes.
10: In max, based on the gunspec file, export each animation based on the animation list in the gunspec.
11: For the lower animations (idle_to_low, idle_low, idle_to_nonthreat etc), use the first few frames of the "putaway" animation.
12: Once you've exported all the animations, export the reference mesh and compile using the .qc supplied in the Sourcesdk weapon's folder, use GUIstudioMDL.
13: If all is successful, and you compiled the weapon successfully, the game you compiled it for should have brand-spanking new weapons.
14: If not, read the error message in GUIstudio's interface.