From 86657e59d0b868ce91ac44d9ace8a38a2a6b774d 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 65d5a123e..b96d966c8 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 e78029225..709acff8c 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1093,6 +1093,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) { @@ -1109,7 +1110,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 @@ -1124,7 +1125,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; } @@ -1138,7 +1139,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 @@ -1168,7 +1169,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; } @@ -1179,11 +1180,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