W1="weaponholder" createVehicle getpos Table; W1 addWeaponCargo ["beretta",1]
W1 Setpos [Getpos Table Select 0, Getpos Table Select 1, 0.8]
Thats all you need do. The fist line makes a weaponholder, the next part of that line puts in a beretta. You can change the name to add a different weapon. Then the second line puts the gun up on the table. Change the last number at the end to get the right height.