Ok, there's been a few changes I've been working on.
New console variables!
IntermissionTeamChange On/Off (Default is Off)
This variable controls whether or not players are allowed to switch to and from spectating during intermissions. I recommend you keep this off if you're playing public games.
However this variable does nothing if ForceIntermissionJoin is enabled. Read below for more details.
ForceIntermissionJoin On/Off (Default is Off)
This is your nuke button. If you set this variable to On then all players will be forced out of spectating during intermissions. This stops players from spectating before a match ends to avoid being IT.
This command will also stop players from changing teams during intermissions regardless of IntermissionTeamChange being on or off (it basically beats it out, this is intentional).
Please keep in mind that this is a last resort, forcing players out of spectator when they just want to watch could cause anger, complaining, and/or abandonment of your game. Only use this if the tactical spectating becomes a problem.
This variable doesn't stop spectating during game, it only enters every player in game to make IT selection fair.
Besides that I also cleaned up the code and re-ordered some functions and lines to better optimize it.