Over the past couple of years I had problems with leg cramps during the night too, especially after hiking or other vigorous exercise in warm weather. My doctor said, most likely electrolyte imbalance. So I toook the usual supplements. They helped, but what really solved the problem was increased salt consumption.

When we were young and active athletes, our coaches encouraged us to take salt pills in warm weather. It was good advice then and good advice now. If you are exerting yourself and sweating, try increasing your salt intake with food or use salt pills to keep cramps at bay.