summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/g_admin.c60
-rw-r--r--src/game/g_admin.h1
2 files changed, 61 insertions, 0 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 2f92d5c2..49aa46da 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -189,6 +189,11 @@ g_admin_cmd_t g_admin_cmds[ ] =
"[^3on|off^7]"
},
+ {"setdisabled", G_admin_setdisabled, qfalse, "setdisabled",
+ "set disabled buildables, classes or equipment",
+ "[^3buildables|classese|equipment^7] (^5list^7)"
+ },
+
{"setivo", G_admin_setivo, qfalse, "setivo",
"set an intermission view override",
"[^3s|a|h^7]"
@@ -1609,6 +1614,61 @@ qboolean G_admin_setdevmode( gentity_t *ent )
}
}
+qboolean G_admin_setdisabled( gentity_t *ent )
+{
+ const char *name;
+ vmCvar_t *cvar;
+ char value[ MAX_STRING_CHARS ];
+
+ if( trap_Argc() < 2 )
+ {
+ usage:
+ ADMP( "^3setdisabled: ^7usage: setdisabled [buildables|classes|equipment] (list)\n" );
+ return qfalse;
+ }
+ else if( trap_Argc() > 3 )
+ {
+ ADMP( "^3setdisabled: ^7excessive arguments\n" );
+ goto usage;
+ }
+
+ trap_Argv( 1, value, sizeof( value ) );
+ if( !Q_stricmp( value, "buildables" ) )
+ {
+ name = "buildables";
+ cvar = &g_disabledBuildables;
+ }
+ else if( !Q_stricmp( value, "classes" ) )
+ {
+ name = "classes";
+ cvar = &g_disabledClasses;
+ }
+ else if( !Q_stricmp( value, "equipment" ) )
+ {
+ name = "equipment";
+ cvar = &g_disabledEquipment;
+ }
+ else
+ {
+ ADMP( "^3setdisabled: ^7invalid set\n" );
+ goto usage;
+ }
+
+ if( trap_Argc() >= 3 )
+ trap_Argv( 2, value, sizeof( value ) );
+ else
+ value[ 0 ] = '\0';
+
+ trap_Cvar_Set( va( "g_disabled%s", name ), value );
+ trap_Cvar_Update( cvar );
+ BG_InitAllowedGameElements();
+
+ AP( va( "print \"^3setdisabled: ^7%s ^7has changed the set of disabled %s to: %s\n\"",
+ ent ? ent->client->pers.netname : "console", name, value ) );
+
+ return qtrue;
+}
+
qboolean G_admin_kick( gentity_t *ent )
{
int pid;
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index a018ea81..10727bd3 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -186,6 +186,7 @@ qboolean G_admin_builder( gentity_t *ent );
qboolean G_admin_buildlog( gentity_t *ent );
qboolean G_admin_revert( gentity_t *ent );
qboolean G_admin_setdevmode( gentity_t *ent );
+qboolean G_admin_setdisabled( gentity_t *ent );
void G_admin_print( gentity_t *ent, char *m );
void G_admin_buffer_print( gentity_t *ent, char *m );