This should work:
%scalar = -1; // -1 is down 45 degrees, 1 is up 45 degrees.
%vec = %obj.getMuzzleVector(%slot);
%vec_x = firstWord(%vec);
%vec_y = getWord(%vec, 1);
%vec_z = (-%scalar) * (%vec_x + %vec_y);
%projectile.initialVelocity = (%vec_x SPC %vec_y SPC %vec_z);
Where %obj is the player shooting the projectile, %projectile is the projectile, and %slot is the slot where it is mounted.