Code: Select all
local sound_active = false
mysound = sound_add("SLAP.wav")
function new_speed(speed)
speed = var_cap(speed, 0, 170)
if speed > 20 and speed < 60 and not sound_active then
sound_loop(mysound)
sound_active = true
elseif (speed <= 20 or speed >= 60) and sound_active then
sound_stop(mysound)
sound_active = false
end
end
-------------------
-- Bus subscribe --
-------------------
fsx_variable_subscribe("AIRSPEED INDICATED", "knots", new_speed)