added configurable time between pauses, to reduce spam

This commit is contained in:
floff 2010-12-13 23:16:53 +01:00 committed by noother
parent 5b56598056
commit 4a93c28eb8
4 changed files with 13 additions and 3 deletions

View file

@ -111,6 +111,7 @@ MACRO_CONFIG_INT(SvHideScore, sv_hide_score, 0, 0, 1, CFGFLAG_SERVER, "Whether p
MACRO_CONFIG_INT(SvTimer, sv_timer, 0, 0, 1, CFGFLAG_SERVER, "Whether timer commands are allowed or not", 3)
MACRO_CONFIG_INT(SvPauseable, sv_pauseable, 1, 0, 1, CFGFLAG_SERVER, "Whether players can pause their char or not", 3)
MACRO_CONFIG_INT(SvPauseTime, sv_pause_time, 0, 0, 1, CFGFLAG_SERVER, "Whether '/pause' and 'sv_max_dc_restore' pauses the time of player or not", 3)
MACRO_CONFIG_INT(SvPauseFrequency, sv_pause_frequency, 5, 0, 9999, CFGFLAG_SERVER, "The minimum allowed delay between pauses", 3)
MACRO_CONFIG_INT(SvEmotionalTees, sv_emotional_tees, 1, 0, 1, CFGFLAG_SERVER, "Whether eye change of tees is enabled or not", 3)
MACRO_CONFIG_INT(SvEmoticonDelay, sv_emoticon_delay, 3, 0, 9999, CFGFLAG_SERVER, "The time in seconds between over-head emoticons", 3)

View file

@ -717,9 +717,14 @@ void CGameContext::ConTogglePause(IConsole::IResult *pResult, void *pUserData, i
CCharacter* chr = pPlayer->GetCharacter();
if(!pPlayer->GetTeam() && chr && (!chr->m_aWeapons[WEAPON_NINJA].m_Got || chr->m_FreezeTime) && chr->IsGrounded() && chr->m_Pos==chr->m_PrevPos && !pPlayer->m_InfoSaved)
{
pPlayer->SaveCharacter();
pPlayer->SetTeam(-1);
pPlayer->m_InfoSaved = true;
if(pPlayer->m_Last_Pause + pSelf->Server()->TickSpeed() * g_Config.m_SvPauseFrequency <= pSelf->Server()->Tick()) {
pPlayer->SaveCharacter();
pPlayer->SetTeam(-1);
pPlayer->m_InfoSaved = true;
pPlayer->m_Last_Pause = pSelf->Server()->Tick();
}
else
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "You can\'t pause that often.");
}
else if(pPlayer->GetTeam()==-1 && pPlayer->m_InfoSaved)
{

View file

@ -33,6 +33,9 @@ CPlayer::CPlayer(CGameContext *pGameServer, int CID, int Team)
m_Invisible = false;
m_IsUsingDDRaceClient = false;
// Variable initialized:
m_Last_Pause = 0;
}
CPlayer::~CPlayer()

View file

@ -81,6 +81,7 @@ public:
int64 m_Last_ChangeInfo;
int64 m_Last_Emote;
int64 m_Last_Kill;
int64 m_Last_Pause;
bool m_Invisible;