function StateToStr added, shutdown behaviour changed

Added a function StateToStr (from dgoersch in the forum) to translate
player states into human readable strings.

Changed shutdown behaviour from onShutdown to onUnload recommended by
Torben as onShutdown didn't work as expected. onUnload does the trick.