}
}
-void SetPlayerTeam(entity pl, float t, float s, float noprint)
+bool SetPlayerTeamSimple(entity player, int teamnum)
{
- float _color;
-
- if(t == 4)
- _color = NUM_TEAM_4 - 1;
- else if(t == 3)
- _color = NUM_TEAM_3 - 1;
- else if(t == 2)
- _color = NUM_TEAM_2 - 1;
- else
- _color = NUM_TEAM_1 - 1;
-
- SetPlayerColors(pl,_color);
-
- if(t != s) {
- LogTeamchange(pl.playerid, pl.team, 3); // log manual team join
+ return MoveToTeam(player, teamnum, 6);
+}
- if(!noprint)
- bprint(pl.netname, "^7 has changed from ", Team_NumberToColoredFullName(s), "^7 to ", Team_NumberToColoredFullName(t), "\n");
+void SetPlayerTeam(entity pl, float t, float s, float noprint)
+{
+ if (t == s)
+ {
+ return;
}
-
+ float teamnum = Team_NumberToTeam(t);
+ SetPlayerTeamSimple(pl, teamnum);
+ LogTeamchange(pl.playerid, pl.team, 3); // log manual team join
+ if (noprint)
+ {
+ return;
+ }
+ bprint(playername(pl, false), "^7 has changed from ", Team_NumberToColoredFullName(s), "^7 to ", Team_NumberToColoredFullName(t), "\n");
}
// set c1...c4 to show what teams are allowed
string teament_name = string_null;
- bool mutator_returnvalue = MUTATOR_CALLHOOK(CheckAllowedTeams, teams_mask, teament_name);
+ bool mutator_returnvalue = MUTATOR_CALLHOOK(CheckAllowedTeams, teams_mask, teament_name, for_whom);
teams_mask = M_ARGV(0, float);
teament_name = M_ARGV(1, string);
{
if(!only_return_best)
{
- SetPlayerColors(this, selectedteam - 1);
+ SetPlayerTeamSimple(this, selectedteam);
// when JoinBestTeam is called by client.qc/ClientKill_Now_TeamChange the players team is -1 and thus skipped
// when JoinBestTeam is called by client.qc/ClientConnect the player_id is 0 the log attempt is rejected
if(!only_return_best && !this.bot_forced_team)
{
- TeamchangeFrags(this);
- if(smallest == 1)
- {
- SetPlayerColors(this, NUM_TEAM_1 - 1);
- }
- else if(smallest == 2)
+ smallest = Team_NumberToTeam(smallest);
+ if (smallest != -1)
{
- SetPlayerColors(this, NUM_TEAM_2 - 1);
- }
- else if(smallest == 3)
- {
- SetPlayerColors(this, NUM_TEAM_3 - 1);
- }
- else if(smallest == 4)
- {
- SetPlayerColors(this, NUM_TEAM_4 - 1);
+ TeamchangeFrags(this);
+ SetPlayerTeamSimple(this, smallest);
}
else
{
// not changing teams
if(scolor == dcolor)
{
- //bprint("same team change\n");
SetPlayerTeam(this, dteam, steam, true);
return;
}
TeamchangeFrags(this);
}
- MUTATOR_CALLHOOK(Player_ChangeTeam, this, steam, dteam);
-
SetPlayerTeam(this, dteam, steam, !IS_CLIENT(this));
if(IS_PLAYER(this) && steam != dteam)