02.08.2012, 14:37
It would not be the perfect sollution, but you could also set a timer to set the players position.
A better sollution would be if there was a callback that is called when the player respawns after spectating (Probably OnPlayerSpawn? You need to test that). Then you add a PVarInt, call it something like "p_spectating". When /spec is called, you set p_spectating to 1, when /specoff is called you dont do anything with it.
Then, when that callback is called, you need to check that PVar, whether it's 1 or 0. If it's 1 you make that SetPos stuff, if it's not, then you just proceed normally.
This will probably work.
A better sollution would be if there was a callback that is called when the player respawns after spectating (Probably OnPlayerSpawn? You need to test that). Then you add a PVarInt, call it something like "p_spectating". When /spec is called, you set p_spectating to 1, when /specoff is called you dont do anything with it.
Then, when that callback is called, you need to check that PVar, whether it's 1 or 0. If it's 1 you make that SetPos stuff, if it's not, then you just proceed normally.
This will probably work.