Alternatively, add a 'fired' event handler to the unit which calls a script. The script checks the ammo in the current weapon, and if it's 1 or less removes the weapon, adds another magazine, adds the weapon back (which will be loaded), and selects the weapon.
Tested and works in OFP. The only issue is selecting the correct muzzle.
EDIT - should probably read the question properly before responding huh
Tested with an M2 machine gun and works just the same. I expect all vehicle-based weapons would also work with the above technique.