Adding pause specific message when players use /pause (instead of joined the game/spectators).

This commit is contained in:
Romain Labolle 2011-06-06 21:54:34 +02:00 committed by GreYFoX
parent c17d3cdeda
commit 0ae0b0bb83
2 changed files with 11 additions and 3 deletions

View file

@ -471,17 +471,17 @@ void CGameContext::ConTogglePause(IConsole::IResult *pResult, void *pUserData, i
if(pPlayer->m_LastSetTeam + pSelf->Server()->TickSpeed() * g_Config.m_SvPauseFrequency <= pSelf->Server()->Tick()) if(pPlayer->m_LastSetTeam + pSelf->Server()->TickSpeed() * g_Config.m_SvPauseFrequency <= pSelf->Server()->Tick())
{ {
pPlayer->SaveCharacter(); pPlayer->SaveCharacter();
pPlayer->SetTeam(TEAM_SPECTATORS);
pPlayer->m_InfoSaved = true; pPlayer->m_InfoSaved = true;
pPlayer->SetTeam(TEAM_SPECTATORS);
} }
else else
pResult->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", "You can\'t pause that often."); pResult->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", "You can\'t pause that often.");
} }
else if(pPlayer->GetTeam()==TEAM_SPECTATORS && pPlayer->m_InfoSaved) else if(pPlayer->GetTeam()==TEAM_SPECTATORS && pPlayer->m_InfoSaved)
{ {
pPlayer->m_InfoSaved = false;
pPlayer->m_PauseInfo.m_Respawn = true; pPlayer->m_PauseInfo.m_Respawn = true;
pPlayer->SetTeam(TEAM_RED); pPlayer->SetTeam(TEAM_RED);
pPlayer->m_InfoSaved = false;
//pPlayer->LoadCharacter();//TODO:Check if this system Works //pPlayer->LoadCharacter();//TODO:Check if this system Works
} }
else if(pChr) else if(pChr)

View file

@ -267,6 +267,14 @@ void CPlayer::SetTeam(int Team)
return; return;
char aBuf[512]; char aBuf[512];
if(m_InfoSaved)
{
if(Team == TEAM_SPECTATORS)
str_format(aBuf, sizeof(aBuf), "'%s' paused", Server()->ClientName(m_ClientID));
else
str_format(aBuf, sizeof(aBuf), "'%s' resumed", Server()->ClientName(m_ClientID));
}
else
str_format(aBuf, sizeof(aBuf), "'%s' joined the %s", Server()->ClientName(m_ClientID), GameServer()->m_pController->GetTeamName(Team)); str_format(aBuf, sizeof(aBuf), "'%s' joined the %s", Server()->ClientName(m_ClientID), GameServer()->m_pController->GetTeamName(Team));
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf); GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf);