]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/sv_cmd.qc
GameCommand_moveplayer: fix wrong team name in a message
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / sv_cmd.qc
index 111fc1878588b07e5b44d9e8f12c421db1673468..81ef50aeda4a3120c08b71c2c80e77f09ead2c63 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);
@@ -788,15 +793,14 @@ void GameCommand_gettaginfo(int request, int argc)
                                if (i)
                                {
                                        v = gettaginfo(tmp_entity, i);
-                                       LOG_INFOF(
-                                               "model %s frame %s tag %s index %s parent %s",
+                                       LOG_HELPF("model %s frame %s tag %s index %s parent %s",
                                                tmp_entity.model, ftos(tmp_entity.frame), gettaginfo_name, ftos(i), ftos(gettaginfo_parent)
                                        );
-                                       LOG_INFOF(" vector = %s %s %s", ftos(v.x), ftos(v.y), ftos(v.z));
-                                       LOG_INFOF(" offset = %s %s %s", ftos(gettaginfo_offset.x), ftos(gettaginfo_offset.y), ftos(gettaginfo_offset.z));
-                                       LOG_INFOF(" forward = %s %s %s", ftos(gettaginfo_forward.x), ftos(gettaginfo_forward.y), ftos(gettaginfo_forward.z));
-                                       LOG_INFOF(" right = %s %s %s", ftos(gettaginfo_right.x), ftos(gettaginfo_right.y), ftos(gettaginfo_right.z));
-                                       LOG_INFOF(" up = %s %s %s", ftos(gettaginfo_up.x), ftos(gettaginfo_up.y), ftos(gettaginfo_up.z));
+                                       LOG_HELPF(" vector = %s %s %s", ftos(v.x), ftos(v.y), ftos(v.z));
+                                       LOG_HELPF(" offset = %s %s %s", ftos(gettaginfo_offset.x), ftos(gettaginfo_offset.y), ftos(gettaginfo_offset.z));
+                                       LOG_HELPF(" forward = %s %s %s", ftos(gettaginfo_forward.x), ftos(gettaginfo_forward.y), ftos(gettaginfo_forward.z));
+                                       LOG_HELPF(" right = %s %s %s", ftos(gettaginfo_right.x), ftos(gettaginfo_right.y), ftos(gettaginfo_right.z));
+                                       LOG_HELPF(" up = %s %s %s", ftos(gettaginfo_up.x), ftos(gettaginfo_up.y), ftos(gettaginfo_up.z));
                                        if (argc >= 6)
                                        {
                                                v.y = -v.y;
@@ -889,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)));
@@ -975,13 +984,13 @@ void GameCommand_moveplayer(int request, int argc)
                        string targets = strreplace(",", " ", argv(1));
                        string original_targets = strreplace(" ", ", ", targets);
                        string destination = argv(2);
+                       if (destination == "spec")
+                               destination = "spectator";
 
-                       string successful, t;
-                       successful = string_null;
-
-                       // lets see if the target(s) even actually exist.
                        if ((targets) && (destination))
                        {
+                               string successful = string_null;
+                               string t;
                                for ( ; targets; )
                                {
                                        t = car(targets);
@@ -998,7 +1007,7 @@ void GameCommand_moveplayer(int request, int argc)
                                        }
 
                                        // Where are we putting this player?
-                                       if (destination == "spec" || destination == "spectator")
+                                       if (destination == "spectator")
                                        {
                                                if (!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
@@ -1020,6 +1029,7 @@ void GameCommand_moveplayer(int request, int argc)
                                                        if (teamplay)
                                                        {
                                                                // set up
+                                                               string pl_name = playername(client.netname, client.team, false);
                                                                int save = Player_GetForcedTeamIndex(client);
                                                                Player_SetForcedTeamIndex(client, TEAM_FORCE_DEFAULT);
 
@@ -1029,7 +1039,7 @@ void GameCommand_moveplayer(int request, int argc)
                                                                if (team_num == client.team)  // already on the destination team
                                                                {
                                                                        // keep the forcing undone
-                                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client.netname, client.team, false), ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7."));
+                                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") is already on the ", Team_ColoredFullName(team_num), (targets ? "^7, skipping to next player.\n" : "^7."));
                                                                        continue;
                                                                }
                                                                else if (team_num == 0)  // auto team
@@ -1063,12 +1073,12 @@ void GameCommand_moveplayer(int request, int argc)
                                                                Player_SetForcedTeamIndex(client, TEAM_FORCE_DEFAULT);
                                                                if (MoveToTeam(client, team_id, 6))
                                                                {
-                                                                       successful = strcat(successful, (successful ? ", " : ""), playername(client.netname, client.team, false));
-                                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client.netname, client.team, false), ") has been moved to the ", Team_ColoredFullName(team_id), "^7.");
+                                                                       successful = strcat(successful, (successful ? ", " : ""), pl_name);
+                                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") has been moved to the ", Team_ColoredFullName(team_num), "^7.");
                                                                }
                                                                else
                                                                {
-                                                                       LOG_INFO("Unable to move player ", ftos(GetFilteredNumber(t)), " (", playername(client.netname, client.team, false), ")");
+                                                                       LOG_INFO("Unable to move player ", ftos(GetFilteredNumber(t)), " (", pl_name, ")");
                                                                }
                                                                continue;
                                                        }