]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Print an error message if gametype and gotomap are executed when the server isn't...
authorterencehill <piuntn@gmail.com>
Wed, 3 Mar 2021 22:51:24 +0000 (23:51 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 3 Mar 2021 22:51:24 +0000 (23:51 +0100)
qcsrc/server/command/sv_cmd.qc
qcsrc/server/world.qc
qcsrc/server/world.qh

index 200aafe2c57a4a8451f2a2d74ef657e3b0495851..9cb909d541092ecf3aa1de46beaac0cf051c2011 100644 (file)
@@ -715,6 +715,11 @@ void GameCommand_gametype(int request, int argc)
        {
                case CMD_REQUEST_COMMAND:
                {
+                       if (!world_initialized)
+                       {
+                               LOG_INFOF("This command works only when the server is running.");
+                               return;
+                       }
                        if (argv(1) != "")
                        {
                                string s = argv(1);
@@ -888,6 +893,11 @@ void GameCommand_gotomap(int request, int argc)
        {
                case CMD_REQUEST_COMMAND:
                {
+                       if (!world_initialized)
+                       {
+                               LOG_INFOF("This command works only when the server is running.");
+                               return;
+                       }
                        if (argv(1))
                        {
                                LOG_INFO(GotoMap(argv(1)));
index 864ac5dab7a185c8e3444f7b07e5f7efc6227cb2..b61f75ceb7068f00bf85b76a05a88f04a016dac9 100644 (file)
@@ -100,7 +100,6 @@ void PingPLReport_Spawn()
 }
 
 const float SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS = 1;
-float world_initialized;
 
 void SetDefaultAlpha()
 {
index 4141c99e29182a49daff6c1678b52dadad704c3d..e79a6f9df3ac4dfaf3ee936b504f0e94293fb6aa 100644 (file)
@@ -35,6 +35,8 @@ float checkrules_overtimesadded; //how many overtimes have been already added
 // flag set on worldspawn so that the code knows if it is dedicated or not
 bool server_is_dedicated;
 
+int world_initialized;
+
 string cvar_changes;
 string cvar_purechanges;
 float cvar_purechanges_count;