It would be nice if there is some kind of event that will be called right before a player goes into observer mode (and all code in that event block gets executed before the player actually goes into observer mode).
Something like:
PHP Code:
function onObserverMode() {
//This code gets executed right before player enters observer mode
}