Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
if(!CS(this).just_joined)
- LogTeamchange(this.playerid, -1, 4);
+ LogTeamchange(this.playerid, -1, TEAM_CHANGE_SPECTATOR);
else
CS(this).just_joined = false;
}
if (autocvar_sv_eventlog)
GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot"), ":", playername(this, false)));
- LogTeamchange(this.playerid, this.team, 1);
+ LogTeamchange(this.playerid, this.team, TEAM_CHANGE_CONNECT);
CS(this).just_joined = true; // stop spamming the eventlog with additional lines when the client connects
return result;
}
-void TeamchangeFrags(entity e)
-{
- PlayerScore_Clear(e);
-}
-
-void LogTeamchange(float player_id, float team_number, float type)
-{
- if(!autocvar_sv_eventlog)
- return;
-
- if(player_id < 1)
- return;
-
- GameLogEcho(strcat(":team:", ftos(player_id), ":", ftos(team_number), ":", ftos(type)));
-}
-
void setcolor(entity this, int clr)
{
#if 0
{
return false;
}
- LogTeamchange(player.playerid, player.team, 3); // log manual team join
+ LogTeamchange(player.playerid, player.team, TEAM_CHANGE_MANUAL);
if (no_print)
{
return true;
{
int lockteams_backup = lockteams; // backup any team lock
lockteams = 0; // disable locked teams
- TeamchangeFrags(client); // move the players frags
+ PlayerScore_Clear(client);
if (!Player_SetTeamIndex(client, team_index))
{
lockteams = lockteams_backup; // restore the team lock
player.origin, '0 0 0');
}
+void LogTeamchange(float player_id, float team_number, int type)
+{
+ if(!autocvar_sv_eventlog)
+ return;
+
+ if(player_id < 1)
+ return;
+
+ GameLogEcho(strcat(":team:", ftos(player_id), ":", ftos(team_number), ":", ftos(type)));
+}
+
entity TeamBalance_CheckAllowedTeams(entity for_whom)
{
entity balance = spawn();
if (Team_IsValidIndex(selected_team_index))
{
Player_SetTeamIndex(this, selected_team_index);
- LogTeamchange(this.playerid, this.team, 99);
+ LogTeamchange(this.playerid, this.team, TEAM_CHANGE_AUTO_RELAXED);
TeamBalance_Destroy(balance);
return;
}
}
int best_team_index = TeamBalance_FindBestTeam(balance, this, true);
int old_team_index = Team_TeamToIndex(this.team);
- TeamchangeFrags(this);
+ PlayerScore_Clear(this);
Player_SetTeamIndex(this, best_team_index);
- LogTeamchange(this.playerid, this.team, 2); // log auto join
+ LogTeamchange(this.playerid, this.team, TEAM_CHANGE_AUTO);
if ((old_team_index != -1) && !IS_BOT_CLIENT(this))
{
TeamBalance_AutoBalanceBots(balance, old_team_index, best_team_index);
if (IS_PLAYER(this) && source_team_index != destination_team_index)
{
// reduce frags during a team change
- TeamchangeFrags(this);
+ PlayerScore_Clear(this);
}
if (!SetPlayerTeam(this, destination_team_index, source_team_index,
!IS_CLIENT(this)))
/// \return Number of teams that own control points.
int Team_GetNumberOfTeamsWithControlPoints();
-void TeamchangeFrags(entity e);
-
-void LogTeamchange(float player_id, float team_number, float type);
-
// ======================= Entity specific API ================================
void setcolor(entity this, int clr);
/// \param[in] team_index Index of the team.
/// \param[in] type ???
/// \return True on success, false otherwise.
-bool MoveToTeam(entity client, int team_index, float type);
+bool MoveToTeam(entity client, int team_index, int type);
/// \brief Kills player as a result of team change.
/// \param[in,out] player Player to kill.
void KillPlayerForTeamChange(entity player);
+enum
+{
+ TEAM_CHANGE_CONNECT = 1,
+ TEAM_CHANGE_AUTO = 2,
+ TEAM_CHANGE_MANUAL = 3,
+ TEAM_CHANGE_SPECTATOR = 4,
+ TEAM_CHANGE_AUTO_RELAXED = 99
+};
+
+void LogTeamchange(float player_id, float team_number, int type);
+
// ========================= Team balance API =================================
/// \brief Checks whether the player can join teams according to global