View Single Post
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 04-02-2019 , 12:14   Re: [ANY] How to properly switch team
Reply With Quote #11

Quote:
Originally Posted by Whai View Post
For switch to spectator team, you can just use that :
Again, your snippet, while it might work for this particular use case, just remains a workaround the many hidden rules one game might have when using
PHP Code:
TF2_ChangeClientTeam 
or
PHP Code:
TF2_RespawnPlayer 
Here you miss the point that my snippet is all about switching a player's team, without changing their current state or calling any game functions.


Quote:
Originally Posted by Whai View Post
because with your method, we have to check offsets every updates
PHP Code:
CTeam 
hasn't changed in years by Valve, the vtable offsets used today are likely to be still valid in 20 years from now.

Quote:
Originally Posted by Whai View Post
If you want to change team but not in spectator, just use this
I'm already aware of this method, I've been using it myself for as long as I can remember
https://github.com/Kenzzer/Slender-F...stocks.sp#L600

Again this misses the point of this snippet, here it's provide something that will work "universally" across all source games. (hence the tag [ANY])
You're not safe from a game where the dev decided that they don't care if the player is alive or not, and will make the player respawn anyway regardless of their state/team upon calling sourcemod's
PHP Code:
ChangeClientTeam 


While on the other hand the snippet I provided will work, regardless of the set of "hidden" rules behind the function
PHP Code:
ChangeClientTeam 
__________________

Last edited by Benoist3012; 04-02-2019 at 12:16.
Benoist3012 is offline