Here's a video of a flyover. Thanks to smallg and cybernescence for helping fix the various issues. The pseudo 3d sound part of the script comes from a script posted by HockeyKid a few months ago. This script should work with any vehicle.
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
function aircraft_flight_init(e)
var = 0
nlevel = 0
SetSoundVolume(100)
maxvolume = 100
minvolume = 1
noise = 0
end
function aircraft_flight_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
nvolume = maxvolume - ( PlayerDist / 1000.0 )
if nvolume < minvolume then
StopSound(e,0)
noise=0
else
if noise == 0 then
LoopSound(e,0)
noise = 1
end
SetSoundVolume(nvolume)
end
if var == 0 then
GravityOff(e)
SetAnimationFrames(71,90)
if g_Entity[e]['animating'] == 0 then
LoopAnimation(e);
g_Entity[e]['animating'] =1
end
MoveForward(e,5000)
LoopSound(e,0)
end
end