From 49f95dd3193e06480d41e21d54b291aa6efb0d79 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 30 Oct 2021 22:45:11 +0200 Subject: [PATCH] moveplayer: add # to player number --- qcsrc/server/command/common.qc | 11 ----------- qcsrc/server/command/common.qh | 3 --- qcsrc/server/command/sv_cmd.qc | 13 +++++++------ 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 8d320437a..c2e039f75 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -168,17 +168,6 @@ entity GetFilteredEntity(string input) return selection; } -// same thing, but instead return their edict number -float GetFilteredNumber(string input) -{ - entity selection = GetFilteredEntity(input); - float output; - - output = etof(selection); - - return output; -} - // switch between sprint and print depending on whether the receiver is the server or a player void print_to(entity to, string input) { diff --git a/qcsrc/server/command/common.qh b/qcsrc/server/command/common.qh index b16900a11..5fd66bdbb 100644 --- a/qcsrc/server/command/common.qh +++ b/qcsrc/server/command/common.qh @@ -95,9 +95,6 @@ entity GetIndexedEntity(int argc, float start_index); // find a player which matches the input string, and return their entity entity GetFilteredEntity(string input); -// same thing, but instead return their edict number -float GetFilteredNumber(string input); - // switch between sprint and print depending on whether the receiver is the server or a player void print_to(entity to, string input); diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 4ed6e83ee..c2b25faac 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -998,6 +998,7 @@ void GameCommand_moveplayer(int request, int argc) // Check to see if the player is a valid target client = GetFilteredEntity(t); accepted = VerifyClientEntity(client, false, false); + string client_num_str = ftos(etof(client)); if (accepted <= 0) { @@ -1014,7 +1015,7 @@ void GameCommand_moveplayer(int request, int argc) } else { - LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") is already spectating."); + LOG_INFO("Player #", client_num_str, " (", pl_name, ") is already spectating."); } } else @@ -1029,7 +1030,7 @@ void GameCommand_moveplayer(int request, int argc) if (IS_SPEC(client) || IS_OBSERVER(client)) { // well technically we could, but should we allow that? :P - LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") is not in the game."); + LOG_INFO("Player #", client_num_str, " (", pl_name, ") is not in the game."); continue; } @@ -1043,7 +1044,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)), " (", pl_name, ") is already on the ", Team_ColoredFullName(team_num), "^7."); + LOG_INFO("Player #", client_num_str, " (", pl_name, ") is already on the ", Team_ColoredFullName(team_num), "^7."); continue; } else if (team_num == 0) // auto team @@ -1073,7 +1074,7 @@ void GameCommand_moveplayer(int request, int argc) } if (!TeamBalance_IsTeamAllowed(balance, team_id)) { - LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") is not allowed to join the ", Team_ColoredFullName(team_num), "^7."); + LOG_INFO("Player #", client_num_str, " (", pl_name, ") is not allowed to join the ", Team_ColoredFullName(team_num), "^7."); TeamBalance_Destroy(balance); continue; } @@ -1084,11 +1085,11 @@ void GameCommand_moveplayer(int request, int argc) if (MoveToTeam(client, team_id, 6)) { successful = strcat(successful, (successful ? ", " : ""), pl_name); - LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") has been moved to the ", Team_ColoredFullName(team_num), "^7."); + LOG_INFO("Player #", client_num_str, " (", pl_name, ") has been moved to the ", Team_ColoredFullName(team_num), "^7."); } else { - LOG_INFO("Unable to move player ", ftos(GetFilteredNumber(t)), " (", pl_name, ")"); + LOG_INFO("Unable to move player #", client_num_str, " (", pl_name, ")"); } } } // loop end -- 2.39.2