diff --git a/src/game/ddracecommands.h b/src/game/ddracecommands.h index 7d5b4b85b..4a69e902b 100644 --- a/src/game/ddracecommands.h +++ b/src/game/ddracecommands.h @@ -40,8 +40,8 @@ CONSOLE_COMMAND("help", "?r", CFGFLAG_SERVER, ConHelp, this, "Shows help to comm CONSOLE_COMMAND("info", "", CFGFLAG_SERVER, ConInfo, this, "Shows info about this server", IConsole::CONSOLELEVEL_USER) CONSOLE_COMMAND("me", "r", CFGFLAG_SERVER, ConMe, this, "Like the famous irc command '/me says hi' will display ' says hi'", IConsole::CONSOLELEVEL_USER) CONSOLE_COMMAND("pause", "", CFGFLAG_SERVER, ConTogglePause, this, "Toggles pause on/off (if activated on server)", IConsole::CONSOLELEVEL_USER) -CONSOLE_COMMAND("force_pause", "v?i", CFGFLAG_SERVER, ConForcePause, this, "Force v to pause for i seconds", IConsole::CONSOLELEVEL_ADMIN) -CONSOLE_COMMAND("force_unpause", "v", CFGFLAG_SERVER, ConForceUnpause, this, "Force v to unpause", IConsole::CONSOLELEVEL_ADMIN) +CONSOLE_COMMAND("force_pause", "vi", CFGFLAG_SERVER, ConForcePause, this, "Force v to pause for i seconds", IConsole::CONSOLELEVEL_CONFIG) +CONSOLE_COMMAND("force_unpause", "v", CFGFLAG_SERVER, ConForcePause, this, "Set force-pause timer of v to 0.", IConsole::CONSOLELEVEL_ADMIN) CONSOLE_COMMAND("rank", "?r", CFGFLAG_SERVER, ConRank, this, "Shows the rank of player with name r (your rank by default)", IConsole::CONSOLELEVEL_USER) CONSOLE_COMMAND("rules", "", CFGFLAG_SERVER, ConRules, this, "Shows the server rules", IConsole::CONSOLELEVEL_USER) CONSOLE_COMMAND("team", "?i", CFGFLAG_SERVER, ConJoinTeam, this, "Lets you join team i (shows your team if left blank)", IConsole::CONSOLELEVEL_USER) diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index 8576d1b17..14168e362 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -478,7 +478,7 @@ void CGameContext::ConTogglePause(IConsole::IResult *pResult, void *pUserData, i else pResult->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", "You can\'t pause that often."); } - else if(pPlayer->GetTeam()==TEAM_SPECTATORS && pPlayer->m_InfoSaved && pPlayer->m_ForcePauseTime==0) + else if(pPlayer->GetTeam()==TEAM_SPECTATORS && pPlayer->m_InfoSaved && pPlayer->m_ForcePauseTime == 0) { pPlayer->m_PauseInfo.m_Respawn = true; pPlayer->SetTeam(TEAM_RED); @@ -508,20 +508,18 @@ void CGameContext::ConForcePause(IConsole::IResult *pResult, void *pUserData, in CGameContext *pSelf = (CGameContext *)pUserData; CServer* pServ = (CServer*)pSelf->Server(); int Victim = pResult->GetVictim(); - int Seconds; + int Seconds = 0; char aBuf[128]; - if(pResult->NumArguments() > 0) - Seconds = pResult->GetInteger(0); - else - Seconds = g_Config.m_SvVotePauseTime; + if(pResult->NumArguments() > 0 && ClientID < 0) + Seconds = clamp(pResult->GetInteger(0), 0, 15); CPlayer *pPlayer = pSelf->m_apPlayers[Victim]; - if(!pPlayer) + if(!pPlayer || (!Seconds && ClientID >= 0)) return; CCharacter* pChr = pPlayer->GetCharacter(); - if(!pPlayer->GetTeam() && pChr && !pPlayer->m_InfoSaved) + if(!pPlayer->GetTeam() && pChr && !pPlayer->m_InfoSaved && ClientID < 0) { pPlayer->SaveCharacter(); pPlayer->m_InfoSaved = true; @@ -535,37 +533,7 @@ void CGameContext::ConForcePause(IConsole::IResult *pResult, void *pUserData, in if(ClientID < 0) str_format(aBuf, sizeof(aBuf), "'%s' has been force-paused for %d seconds", pServ->ClientName(Victim), Seconds); else - str_format(aBuf, sizeof(aBuf), "'%s' has been force-paused for %d seconds by '%s'", pServ->ClientName(Victim), Seconds, pServ->ClientName(ClientID)); - pSelf->SendChat(-1, CHAT_ALL, aBuf); -} - -void CGameContext::ConForceUnpause(IConsole::IResult *pResult, void *pUserData, int ClientID) -{ - CGameContext *pSelf = (CGameContext *)pUserData; - CServer* pServ = (CServer*)pSelf->Server(); - int Victim = pResult->GetVictim(); - char aBuf[128]; - - CPlayer *pPlayer = pSelf->m_apPlayers[Victim]; - if(!pPlayer) - return; - - if(pPlayer->GetTeam()==TEAM_SPECTATORS && pPlayer->m_InfoSaved) - { - pPlayer->m_PauseInfo.m_Respawn = true; - pPlayer->SetTeam(TEAM_RED); - pPlayer->m_InfoSaved = false; - //pPlayer->LoadCharacter();//TODO:Check if this system Works - pPlayer->m_ForcePauseTime = 0; - } - else // Shouldn't be reached - { - pPlayer->m_ForcePauseTime = 0; - } - if(ClientID < 0) - str_format(aBuf, sizeof(aBuf), "'%s' has been force-unpaused", pServ->ClientName(Victim)); - else - str_format(aBuf, sizeof(aBuf), "'%s' has been force-unpaused by '%s'", pServ->ClientName(Victim), pServ->ClientName(ClientID)); + str_format(aBuf, sizeof(aBuf), "Force-pause of '%s' have been removed by '%s'", pServ->ClientName(Victim), pServ->ClientName(ClientID)); pSelf->SendChat(-1, CHAT_ALL, aBuf); } diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 7dd0ff614..893bc20e3 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -945,8 +945,8 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) if(g_Config.m_SvPauseable && g_Config.m_SvVotePause) { str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to pause '%s' for %d seconds (%s)", Server()->ClientName(ClientID), Server()->ClientName(SpectateID), g_Config.m_SvVotePauseTime, pReason); - str_format(aDesc, sizeof(aDesc), "Pause '%s' (%ds)", Server()->ClientName(SpectateID), g_Config.m_SvVotePauseTime); - str_format(aCmd, sizeof(aCmd), "force_pause %d", SpectateID); + str_format(aDesc, sizeof(aDesc), "Pause '%s' (%ds)", Server()->ClientName(SpectateID), g_Config.m_SvVotePauseTime); + str_format(aCmd, sizeof(aCmd), "force_pause %d %d", SpectateID, g_Config.m_SvVotePauseTime); } else { diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 6be95466e..488df5887 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -219,7 +219,6 @@ private: static void ConKill(IConsole::IResult *pResult, void *pUserData, int ClientID); static void ConTogglePause(IConsole::IResult *pResult, void *pUserData, int ClientID); static void ConForcePause(IConsole::IResult *pResult, void *pUserData, int ClientID); - static void ConForceUnpause(IConsole::IResult *pResult, void *pUserData, int ClientID); static void ConTop5(IConsole::IResult *pResult, void *pUserData, int ClientID); #if defined(CONF_SQL) static void ConTimes(IConsole::IResult *pResult, void *pUserData, int ClientID); diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 6b9bf5002..4aaa7eba3 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -64,13 +64,6 @@ void CPlayer::Tick() if (m_ChatScore > 0) m_ChatScore--; - if (g_Config.m_SvVotePauseAuto && m_ForcePauseTime==1 && GetTeam()==TEAM_SPECTATORS && m_InfoSaved) - { - m_InfoSaved = false; - m_PauseInfo.m_Respawn = true; - SetTeam(TEAM_RED); - } - if (m_ForcePauseTime > 0) m_ForcePauseTime--; diff --git a/src/game/variables.h b/src/game/variables.h index 072cf7953..fad103dc1 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -79,8 +79,7 @@ MACRO_CONFIG_INT(SvVoteKickMin, sv_vote_kick_min, 0, 0, MAX_CLIENTS, CFGFLAG_SER MACRO_CONFIG_INT(SvVoteKickBantime, sv_vote_kick_bantime, 5, 0, 1440, CFGFLAG_SERVER, "The time to ban a player if kicked by vote. 0 makes it just use kick", IConsole::CONSOLELEVEL_ADMIN) MACRO_CONFIG_INT(SvVotePause, sv_vote_pause, 1, 0, 1, CFGFLAG_SERVER, "Allow voting to pause players (instead of moving to spectators)", IConsole::CONSOLELEVEL_ADMIN) -MACRO_CONFIG_INT(SvVotePauseTime, sv_vote_pause_time, 60, 0, 3600, CFGFLAG_SERVER, "The time (in seconds) players have to wait in pause when paused by vote", IConsole::CONSOLELEVEL_ADMIN) -MACRO_CONFIG_INT(SvVotePauseAuto, sv_vote_pause_auto, 0, 0, 1, CFGFLAG_SERVER, "Automatically unpaused players after the force-pause delay or not", IConsole::CONSOLELEVEL_ADMIN) +MACRO_CONFIG_INT(SvVotePauseTime, sv_vote_pause_time, 10, 0, 15, CFGFLAG_SERVER, "The time (in seconds) players have to wait in pause when paused by vote", IConsole::CONSOLELEVEL_ADMIN) // debug #ifdef CONF_DEBUG // this one can crash the server if not used correctly MACRO_CONFIG_INT(DbgDummies, dbg_dummies, 0, 0, 15, CFGFLAG_SERVER, "", IConsole::CONSOLELEVEL_ADMIN)