Flash for my Nikon D5000?

So i own a NikonD5000 and i got ahold of some old lenses that work amazing on my lense, and love it. Especailly the 50mm f/1.8 series e lens. But Flash and metering doesn't work with this lens. When i try to use my sb400 or my pop up flash it indicates this
Flash is in TTL Mode chose another setting or use a CPU Lens, is there a way around this bcuz i have to stay in the Manual Setting in order for these older lenses to work, or is there a flash i can use out there? Please let me know. I don't want to get a new lens so don't tell me that. Just possibly Buy a new Flash.

You need to use a AF-S Nikkor lens for the TTL feature to function.
It looks like you found a very inexpensive "E" lens and did not research enough before buying it.
In the future ONLY buy AF-S Nikkor lenses
NOTE: The SB400 is just fine for use with your camera. I'm sure it works well with your 18-55 mm lens, right?

Because it's an older lens, it doesn't feed data to your dslr. Flashes with i-ttl or ttl need that information to work correctly.
you have two options:
1. Use a newer lens (the 50mm 1.8 D lens is a great buy) and you can use your SB400.
2. Get a manual flash to choose your own flash settings.
I understand you want to try the combination, but in most cases the 50mm works well in low light and the flash is not quite necessary. Personally, I think the best option is to trade your 50mm E lens for the "D" version. It still won't autofocus on your camera body, but you can use flash with it. If you upgrade your camera body one day, you'll be able to autofocus with the 50mm D lens. (that's what I did)

For your flash to work with the old lens, you need to set the camera's exposure mode to M. Set your flash to manual. With the SB400 there should be a button on the flash to select that. The camera's pop-up flash could be set to manual in the menu. It can help to look up the flashes' guide numbers. Divide the guide number by distance to get the approximately correct aperture setting for your lens. If you are using bounce flash, try opening an extra 2 to 3 stops. The strength of the flash is adjustable in manual mode. If it seems weak it could be that when switching it onto manual the default may be well below full power. You can turn it up.

Please be careful on using that because My friend dropped his camera the lens was cracked, I think it is easily broken
- How to use master commander flash with slave flash with nikon d5000?
- Can i use external flash if my nikon d5000 built-in flash not working?
- External flash: cheap 30$ flash vs expensive 300$ flash, what's the difference?
- How to turn off built-in flash in D5000 while using remote speedlight flash?
- Can the Nikon SB600 flash be triggered with the built-in flash of Nikon D3000?