diff options
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/server/gamecontext.cpp | 2 | ||||
| -rw-r--r-- | src/game/server/player.cpp | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index d008787a..a50a7ef3 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -803,7 +803,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) return; pPlayer->m_LastSetSpectatorMode = Server()->Tick(); - if(pMsg->m_SpectatorID != SPEC_FREEVIEW && !m_apPlayers[pMsg->m_SpectatorID]) + if(pMsg->m_SpectatorID != SPEC_FREEVIEW && (!m_apPlayers[pMsg->m_SpectatorID] || m_apPlayers[pMsg->m_SpectatorID]->GetTeam() == TEAM_SPECTATORS)) SendChatTarget(ClientID, "Invalid spectator id used"); else pPlayer->m_SpectatorID = pMsg->m_SpectatorID; diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 6c118a19..6387cc9c 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -229,6 +229,16 @@ void CPlayer::SetTeam(int Team) GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf); GameServer()->m_pController->OnPlayerInfoChange(GameServer()->m_apPlayers[m_ClientID]); + + if(Team == TEAM_SPECTATORS) + { + // update spectator modes + for(int i = 0; i < MAX_CLIENTS; ++i) + { + if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->m_SpectatorID == m_ClientID) + GameServer()->m_apPlayers[i]->m_SpectatorID = SPEC_FREEVIEW; + } + } } void CPlayer::TryRespawn() |