Add /team -1

This commit is contained in:
gerdoe-jr 2021-08-10 22:26:07 +03:00
parent 1ee4f0117c
commit 1cf43b48ae
3 changed files with 13 additions and 0 deletions

View file

@ -1034,6 +1034,9 @@ void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData)
{
int Team = pResult->GetInteger(0);
if(Team < 0 || Team >= MAX_CLIENTS )
Team = pController->m_Teams.GetFirstEmptyTeam();
if(pPlayer->m_Last_Team + (int64_t)pSelf->Server()->TickSpeed() * g_Config.m_SvTeamChangeDelay > pSelf->Server()->Tick())
{
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join",

View file

@ -1072,3 +1072,11 @@ void CGameTeams::ResetSavedTeam(int ClientID, int Team)
}
}
}
int CGameTeams::GetFirstEmptyTeam()
{
for(int i = 1; i < MAX_CLIENTS; i++)
if(m_TeamState[i] == TEAMSTATE_EMPTY)
return i;
return -1;
}

View file

@ -111,6 +111,8 @@ public:
void SwapTeamCharacters(CPlayer *pPlayer, CPlayer *pTargetPlayer, int Team);
void ProcessSaveTeam();
int GetFirstEmptyTeam() const;
bool TeeStarted(int ClientID)
{
return m_TeeStarted[ClientID];