From 376f902cc17fb99aced8dbf8c6721f1d204ac0d6 Mon Sep 17 00:00:00 2001 From: Christopher Schwarz Date: Sun, 16 Jan 2011 21:53:23 +0000 Subject: * Print pause time in seconds instead of ms when unpaused * Implement a max pause time of 2 minutes in case an admin lags out or something after pausing --- src/game/g_admin.c | 7 ++++--- src/game/g_main.c | 11 +++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 2229ba25..038c8cdb 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -2880,9 +2880,10 @@ qboolean G_admin_pause( gentity_t *ent ) return qfalse; } - AP( va( "print \"^3pause: ^7%s^7 unpaused the game (Paused for %d msec) \n\"", - ( ent ) ? ent->client->pers.netname : "console",level.pausedTime ) ); - trap_SendServerCommand( -1, "cp \"The game has been unpaused!\"" ); + AP( va( "print \"^3pause: ^7%s^7 unpaused the game (Paused for %d sec) \n\"", + ( ent ) ? ent->client->pers.netname : "console", + (int) ( (float) level.pausedTime / 1000.0f ) ) ); + trap_SendServerCommand( -1, "cp \"The game has been unpaused!\"" ); level.pausedTime = 0; } diff --git a/src/game/g_main.c b/src/game/g_main.c index 01292c66..765dfce4 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -2338,6 +2338,10 @@ void G_RunFrame( int levelTime ) { ptime3000 -= 3000; trap_SendServerCommand( -1, "cp \"The game has been paused. Please wait.\"" ); + + if( level.pausedTime >= 110000 && level.pausedTime <= 119000 ) + trap_SendServerCommand( -1, va( "print \"Server: Game will auto-unpause in %d seconds\n\"", + (int) ( (float) ( 120000 - level.pausedTime ) / 1000.0f ) ) ); } // Prevents clients from getting lagged-out messages @@ -2347,6 +2351,13 @@ void G_RunFrame( int levelTime ) level.clients[ i ].ps.commandTime = levelTime; } + if( level.pausedTime > 120000 ) + { + trap_SendServerCommand( -1, "print \"Server: The game has been unpaused automatically (2 minute max)\n\"" ); + trap_SendServerCommand( -1, "cp \"The game has been unpaused!\"" ); + level.pausedTime = 0; + } + return; } -- cgit