Syntax: Select all
# all three of these are exactly the same thing
# they kill the player
<PlayerEntity>.set_team(<value>)
<PlayerEntity>.team = <value>
<PlayerInfo>.change_team(<value>)
# These are also the same thing, but different from the first set
<PlayerEntity>.SetTeam(<value>)
<PlayerEntity>.InputSetTeam(<value>)
All of the above will kill the player if they are alive and also cause a suicide which is -1 on their score/kills. If the player is already dead, the score remains the same.
You can also set the offset directly:
Syntax: Select all
<PlayerEntity>.m_iTeamNum = <value>
But this has side effects that include crashing the server. You should only use this if you intend to almost immediately return them back to their original team.
If you want, you can find the signature for CCSPlayer::SwitchTeam, which does not kill the player and has no side effects other than a message is printed to chat about the team switch. You can also probably hook the usermessage and make sure that specific one is never printed.