Page 1 of 1

changing teams

Posted: Sun Oct 05, 2014 4:37 am
by 8guawong
<PlayerEntity>.set_team(<value>)
<PlayerEntity>.team = <value>
<PlayerInfo>.change_team(<value>)
<PlayerEntity>.SetTeam(<value>)
<PlayerEntity>.InputSetTeam(<value>)
<PlayerEntity>.switch_team(<value>)

are there any differences???

reason i'm asking if because:
on deathrun maps i want 1 T and rest CT
and on round end i switch the T to CT and randomly pick a CT to be switched to T
i tried <PlayerEntity>.switch_team(<value>)
but if the original T was alive at round end he stays on T's side of the map next round but if T is dead he will stay dead forever..... unless he quit and connect again.....
vice versa for CT

really annoying....


CSGO :mad:

Posted: Sun Oct 05, 2014 4:55 am
by L'In20Cible
They are all the same except for PlayerEntity.switch_team. If you look at the code, you will see that, PlayerEntity.get_team is wrapping PlayerInfo.get_team_index, PlayerEntity.set_team is wrapping PlayerInfo.change_team and that PlayerEntity.team is just a shortcut property that wraps both wrappers. Then, if you look at the SDK, you will see that PlayerEntity.SetTeam and PlayerEntity.InputSetTeam are both wrapping the same input function. Now, if you check the data, you will see that PlayerEntity.switch_team is dynamically calling CBasePlayer::ChangeTeam. This is the one you want to use if you want to keep the player alive while changing his team.

Posted: Sun Oct 05, 2014 12:13 pm
by satoon101
This has been asked a few times before:
http://www.sourcepython.com/showthread.php?506

Posted: Mon Oct 06, 2014 3:12 am
by 8guawong
satoon101 wrote:This has been asked a few times before:
http://www.sourcepython.com/showthread.php?506


yea i know bout that thread just wondering if any of them actually switches player's team

this changes the player's pending team but no the actual team
<PlayerEntity>.set_team(<value>)
<PlayerEntity>.team = <value>
<PlayerInfo>.change_team(<value>)
<PlayerEntity>.SetTeam(<value>)
<PlayerEntity>.InputSetTeam(<value>)

this changes the player's team but when new round starts weird stuff happens (ex: player stays dead... )
<PlayerEntity>.switch_team(<value>)