you will get false as a BOOL when trying to use the IsPedInAnyVehicle(ped, false) native in a aircraft. Try using the IsPedInAnyHeli() native and make a new variable that checks if the ped is in a heli, for example:

local inHeli = IsPedInAnyHeli(ped)

if inHeli then
    SetVehicleEngineOn(vehicle, true, true, false)
    MotorOn = true
else
    MotorOn = false
end

keep in mind that this code is just an example