28.08.2014, 10:59
Redirect_Left told me about this the other day, it is indeed a bug.
When you call TogglePlayerSpectating(...,false), it spawns the player. If you do this before the player has entered class selection, and before any spawn info has been set, the server doesn't know where to spawn the player (or what skin to apply, etc.), so it kicks them. It's probably to prevent against some sort of cheat.
If you want to spawn the player, the solution is to use SetSpawnInfo before TogglePlayerSpectating. If you want to return the player to class selection, use ForceClassSelection instead.
When you call TogglePlayerSpectating(...,false), it spawns the player. If you do this before the player has entered class selection, and before any spawn info has been set, the server doesn't know where to spawn the player (or what skin to apply, etc.), so it kicks them. It's probably to prevent against some sort of cheat.
If you want to spawn the player, the solution is to use SetSpawnInfo before TogglePlayerSpectating. If you want to return the player to class selection, use ForceClassSelection instead.