summaryrefslogtreecommitdiff
path: root/src/game/g_admin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/g_admin.c')
-rw-r--r--src/game/g_admin.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 3b5c8a3..8a77326 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -7997,9 +7997,13 @@ int G_admin_autorevert( gentity_t *ent )
return count;
}
+static int lastRevertCookie = 0;
+static int lastRevertTime = 0;
+static int consoleRevertCookie = 0;
+
qboolean G_admin_revert( gentity_t *ent, int skiparg )
{
- int i = 0, j = 0, repeat = 1, ID = 0, len, matchlen=0;
+ int i = 0, j = 0, repeat = 1, ID = 0, len, matchlen=0, *cookie;
pTeam_t team = PTE_NONE;
qboolean force = qfalse, reached = qfalse;
gentity_t *builder = NULL, *targ;
@@ -8017,6 +8021,18 @@ qboolean G_admin_revert( gentity_t *ent, int skiparg )
ADMP( "^3!revert: ^7usage: !revert (^5xnum^7) (^5#ID^7) (^5-name|num^7) (^5a|h^7)\n" );
return qfalse;
}
+ if( ent )
+ cookie = &ent->client->revertCookie;
+ else
+ cookie = &consoleRevertCookie;
+ if( lastRevertCookie > 0 &&
+ ( lastRevertTime + g_revertCooldownTime.integer * 1000 > level.time ) &&
+ *cookie < lastRevertCookie )
+ {
+ ADMP( "^3!revert: ^7someone just reverted, repeat this command if it's not an error\n" );
+ *cookie = lastRevertCookie;
+ return qfalse;
+ }
for( i = 1; i + skiparg < G_SayArgc( ); i++ )
{
char arg[ 64 ], err[ MAX_STRING_CHARS ];
@@ -8224,6 +8240,10 @@ qboolean G_admin_revert( gentity_t *ent, int skiparg )
{
ADMP( va( "^3!revert: ^7reverted %d buildlog events\n", matchlen ) );
}
+
+ lastRevertTime = level.time;
+ lastRevertCookie++;
+ *cookie = lastRevertCookie;
return qtrue;
}