In the initialization line of the gun, copy and paste this:
this setpos [getPos this select 0, getPos this select 1, y];
y = height (in meters, can also be a decimal or negative number). I think 0.33 works for AT guns in firing positions, but you may need to play with it.