You could animate the gun by setting up a bone structure for it. If you don't know much about bones and binding geometry to them you can find lots of information in the Max help files. Also look up information on Inverse Kinematics (IK).
I have included an image of how I might setup parts of the gun with a bone structure. With bones you are basically putting "joints" in your model, these are simply points in space that move and rotate with each other. The vertices of your model are "bound" (kind of like parented) to these joints, so when they move and rotate so does the gemoetry.
The guys with DarkBasic seem to do things a little different and more efficient, but this is a simple way that could work.