The a340-300 is very much still in production, but only has a few orders. Its not getting any orders from new customers, just add on orders. But it doesn't matter, as it is built on the same line as the A330 and other a340s
Here's how I match up the competitors:
777-200ER - A340 200/300
777-200LR - A340-500
777-300ER - A340-600
The 777-300basic is more or less on its own, a longer version of the 200ER more or less for those who need the extra capacity.
So far, the 777 combined sales are almost double that of the A340. This is the reason I think why the members on another forum are arguing that the 777 is an A330 competitor.
edited to correct my bad spelling