summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIronClawTrem <louie.nutman@gmail.com>2019-08-27 00:26:39 +0100
committerIronClawTrem <louie.nutman@gmail.com>2019-08-27 00:26:39 +0100
commit3e1bb72bf1b410460e87cd10a71d5c8aff0a1a37 (patch)
treeb74418e2d131e316dd0c34d6e73eb42b5339fd0d /src
parent200945a313c0894edb2030e198e480ea13819a58 (diff)
add setrotation command
Diffstat (limited to 'src')
-rw-r--r--src/game/g_admin.c44
-rw-r--r--src/game/g_admin.h1
2 files changed, 45 insertions, 0 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 412f949..422b3c1 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -399,6 +399,11 @@ g_admin_cmd_t g_admin_cmds[ ] =
{"give", G_admin_give, "give",
"give funds to a player",
"[^3name|slot#^7] [^3amount^7]"
+ },
+
+ {"setrotation", G_admin_setrotation, "setrotation",
+ "sets the map rotation",
+ "[^3rotation^7]"
}
};
@@ -7745,3 +7750,42 @@ qboolean G_admin_give(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;
+}
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index c7d61d7..24a256e 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -269,6 +269,7 @@ qboolean G_admin_astage( gentity_t *ent, int skiparg );
qboolean G_admin_bubble( gentity_t *ent, int skiparg );
qboolean G_admin_scrim( gentity_t *ent, int skiparg );
qboolean G_admin_give( 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 );