You need to have the weapon model facing the right direction which may need some trial and error. You then need to scale it so it's big enough for the game. You need a gunspec file. You're best copying an existing gun folder so you can makes changes. For a custom weapon you may need to play around with the position of the gun in the gunspec to make it show up.
When you're happy with the position, go back to your modelling program and add bones to each moving part (stock, magazine, bolt) use the animation values (0,9 10,38 etc) in the gunspec to make animations by moving the parts around to create each sequence (select, idle etc). When you're done, make sure you select every part then export the model in .X format to your gun folder as "HUD.X". You can then test the game and repeat the process until you have the desired result.
To add muzzle flash, place a bone inside the barrel of the gun and name it "Firespot". When you test game, you should see a muzzle flash image when you shoot. In the gunspec, you can adjust the position.
That's how I do it, hope this helps.
By the way, I made a tutorial for doing this with a lot more depth.
Best.