changing teams

Please post any questions about developing your plugin here. Please use the search function before posting!
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

changing teams

Postby 8guawong » Sun Oct 05, 2014 4:37 am

<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:
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sun Oct 05, 2014 4:55 am

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Oct 05, 2014 12:13 pm

This has been asked a few times before:
http://www.sourcepython.com/showthread.php?506
Image
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Mon Oct 06, 2014 3:12 am

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>)

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 148 guests