summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authornarbatucker <narbatucker@hackintosh.local>2018-05-06 17:52:06 +0100
committerPaweł Redman <pawel.redman@gmail.com>2018-05-06 18:52:34 +0200
commit91e6c29de1a563d50289a5052fdecc3914edb0e1 (patch)
treeff07221d105ce7805490afdb7f3deee358cf5c4a /src/game
parent6755aa5c9426a2e1b5cf31cb84243e05d4620c16 (diff)
setrotation command
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_admin.c44
-rw-r--r--src/game/g_admin.h2
2 files changed, 46 insertions, 0 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 9e74df8..4a78616 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -381,6 +381,11 @@ g_admin_cmd_t g_admin_cmds[ ] =
"[^3name|slot#|admin#^7] [^3level^7]"
},
+ {"setrotation", G_admin_setrotation, "setrotation",
+ "sets the map rotation",
+ "[^3rotation^7]"
+ },
+
{"showbans", G_admin_showbans, "showbans",
"display a (partial) list of active bans",
"(^5start at ban#^7) (^5name|IP|'-subnet'^7)"
@@ -2839,6 +2844,45 @@ qboolean G_admin_setlevel( gentity_t *ent, int skiparg )
return qtrue;
}
+extern mapRotations_t mapRotations;
+
+qboolean G_admin_setrotation(gentity_t *ent, int skiparg)
+{
+ char new_rotation[MAX_NAME_LENGTH];
+ int i;
+
+ if (G_SayArgc() < 2 + skiparg)
+ {
+ ADMP("^3!setrotation: ^7usage: !setrotation [rotation]\n");
+ ADMP("Available rotations:\n");
+ goto rotationlist;
+ }
+
+ G_SayArgv(1 + skiparg, new_rotation, sizeof(new_rotation));
+
+ for( i = 0; i < mapRotations.numRotations; i++ )
+ {
+ if( Q_stricmp( mapRotations.rotations[ i ].name, new_rotation ) == 0 )
+ {
+ G_StartMapRotation(new_rotation, qfalse);
+ trap_SendServerCommand( -1, va("print \"^3!setrotation: ^7rotation ^3%s ^7was started by %s",
+ new_rotation, ent ? G_admin_adminPrintName(ent) : "console"));
+ return qtrue;
+ }
+ }
+ ADMP("^3!setrotation: ^7rotation not found. Available rotations:\n");
+ goto rotationlist;
+ rotationlist:
+ {
+ for( i = 0; i < mapRotations.numRotations; i++ )
+ {
+ ADMP(va(" %s\n", mapRotations.rotations[ i ].name));
+ }
+ ADMP(va("Number of available rotations: ^3%d\n", mapRotations.numRotations));
+ }
+ return qfalse;
+}
+
int G_admin_parse_time( const char *time )
{
int seconds = 0, num = 0;
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index e13156e..5e25266 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -373,6 +373,8 @@ qboolean G_admin_versions( gentity_t *ent, int skiparg );
qboolean G_admin_curse( gentity_t *ent, int skiparg );
+qboolean G_admin_setrotation( gentity_t *ent, int skiparg );
+
void G_admin_print( gentity_t *ent, char *m );
void G_admin_buffer_print( gentity_t *ent, char *m );
void G_admin_buffer_begin( void );