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.c70
1 files changed, 69 insertions, 1 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 05fcd2b..98953e2 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -1809,6 +1809,9 @@ qboolean G_admin_cmd_check( gentity_t *ent, qboolean say )
return qtrue;
}
+ if( G_admin_is_restricted( ent, qtrue ) )
+ return qtrue;
+
for( i = 0; i < MAX_ADMIN_COMMANDS && g_admin_commands[ i ]; i++ )
{
if( Q_stricmp( cmd, g_admin_commands[ i ]->command ) )
@@ -3416,6 +3419,67 @@ qboolean G_admin_ban( gentity_t *ent, int skiparg )
return qtrue;
}
+// If true then don't let the player join a team, use the chat or run commands.
+qboolean G_admin_is_restricted(gentity_t *ent, qboolean sendMessage)
+{
+ schachtmeisterJudgement_t *j = NULL;
+ int i;
+
+ // Never restrict admins or whitelisted players.
+ if (G_admin_permission(ent, ADMF_NOAUTOBAHN) ||
+ G_admin_permission(ent, ADMF_IMMUNITY))
+ return qfalse;
+
+ // Find the relevant namelog.
+ // FIXME: this shouldn't require looping over *all* namelogs.
+ for (i = 0; i < MAX_ADMIN_NAMELOGS && g_admin_namelog[i]; i++) {
+ if (g_admin_namelog[i]->slot == ent - g_entities) {
+ j = &g_admin_namelog[i]->smj;
+ break;
+ }
+ }
+
+ // A missing namelog shouldn't happen.
+ if (!j)
+ return qfalse;
+
+ // Restrictions concern only unrated players.
+ if (j->ratingTime)
+ return qfalse;
+
+ // Don't wait forever, allow up to 15 seconds.
+ if (level.time - j->queryTime > 15000)
+ return qfalse;
+
+ if (sendMessage)
+ trap_SendServerCommand(ent - g_entities, "print \"Please wait a moment before doing anything.\n\"");
+
+ return qtrue;
+}
+
+static void admin_autobahn(gentity_t *ent, int rating)
+{
+ // Allow per-GUID exceptions and never autoban admins.
+ if (G_admin_permission(ent, ADMF_NOAUTOBAHN) ||
+ G_admin_permission(ent, ADMF_IMMUNITY))
+ return;
+
+ // Don't do anything if the rating is clear.
+ if (rating >= g_schachtmeisterClearThreshold.integer)
+ return;
+
+ G_AdminsPrintf("%s^7 (#%d) has rating %d\n", ent->client->pers.netname,
+ ent - g_entities, rating);
+
+ // Ban only if the rating is low enough.
+ if (rating > g_schachtmeisterAutobahnThreshold.integer)
+ return;
+
+ trap_SendServerCommand(ent - g_entities, va("disconnect \"%s\"\n",
+ g_schachtmeisterAutobahnMessage.string));
+ trap_DropClient(ent - g_entities, "dropped by the Autobahn");
+}
+
void G_admin_IPA_judgement( const char *ipa, int rating, const char *comment )
{
int i;
@@ -3441,6 +3505,9 @@ void G_admin_IPA_judgement( const char *ipa, int rating, const char *comment )
}
else
j->comment = NULL;
+
+ if( g_admin_namelog[ i ]->slot )
+ admin_autobahn( g_entities + g_admin_namelog[ i ]->slot, j->rating );
}
}
}
@@ -7322,7 +7389,8 @@ static AdminFlagListEntry_t adminFlagList[] =
{ ADMF_SEESINCOGNITO, "sees registered name of players flagged with INCOGNITO" },
{ ADMF_NOSCRIMRESTRICTION, "team joining, vote and chat restrictions during scrims do not apply" },
{ ADMF_NO_CHAT, "can not talk" },
- { ADMF_NO_VOTE, "can not call votes" }
+ { ADMF_NO_VOTE, "can not call votes" },
+ { ADMF_NOAUTOBAHN, "ignored by the Autobahn system" }
};
static int adminNumFlags= sizeof( adminFlagList ) / sizeof( adminFlagList[ 0 ] );