Well, here goes:
What the CyTeam.addTeam() method does, is it adds all players of one team (identified by a TeamType value or a Team ID - an integer basically) to another team (identified by the CyTeam instance on which the method is invoked one). Are you with me so far?
So firstly we have to get the CyTeam instance of the team on which the player will be adjoined. Supposing that we have the TeamType/Team ID of that team, we can use the CyGlobalContext.getTeam() method with the TeamType value as the parameter and get the CyTeam object as the return value.
Next, we need to know what TeamType/Team ID the player in question has. Luckily there is a CyPlayer.getTeam() method that returns this value, but unless you already have the CyPlayer object you need to fetch it with CyGlobalContext.getPlayer() - using the PlayerType/Player ID as the parameter.
So we might end up with something like this (where eTeam and ePlayer have already been defined):
Code:
pTeam = gc.getTeam(eTeam)
pPlayer = gc.getPlayer(ePlayer)
ePlayerTeam = pPlayer.getTeam()
pTeam.addTeam(ePlayerTeam)
This could also be expressed on a single line as:
Code:
gc.getTeam(eTeam).addTeam(gc.getPlayer(ePlayer).getTeam())
Its the exact same thing, its only somewhat more confusing to look at.
If you're doing this with a scenario where all players are the only members of each team and where all the Player/Team IDs match exactly, then this becomes somewhat easier, as you will be able to substitute any PlayerType with its corresponding TeamType, and vice versa.