From eeb8861532ca5ac4cc58ef74f390cc8f64e6e06e Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 3 Feb 2015 01:22:56 +0100 Subject: [PATCH] Add color code handling to GetClientErrorString (example command where it gets called: tell ^1wrong_player_name blabla) --- qcsrc/server/command/common.qc | 8 ++++---- qcsrc/server/command/common.qh | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 09314c745..5b7e761b7 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -48,13 +48,13 @@ float VerifyClientEntity(entity client, float must_be_real, float must_be_bots) } // if the client is not acceptable, return a string to be used for error messages -string GetClientErrorString(float clienterror, string original_input) +string GetClientErrorString_color(float clienterror, string original_input, string col) { switch(clienterror) { - case CLIENT_DOESNT_EXIST: { return strcat("Client '", original_input, "' doesn't exist"); } - case CLIENT_NOT_REAL: { return strcat("Client '", original_input, "' is not real"); } - case CLIENT_NOT_BOT: { return strcat("Client '", original_input, "' is not a bot"); } + case CLIENT_DOESNT_EXIST: { return strcat(col, "Client '", original_input, col, "' doesn't exist"); } + case CLIENT_NOT_REAL: { return strcat(col, "Client '", original_input, col, "' is not real"); } + case CLIENT_NOT_BOT: { return strcat(col, "Client '", original_input, col, "' is not a bot"); } default: { return "Incorrect usage of GetClientErrorString"; } } } diff --git a/qcsrc/server/command/common.qh b/qcsrc/server/command/common.qh index 2a03041d9..ac99e32dc 100644 --- a/qcsrc/server/command/common.qh +++ b/qcsrc/server/command/common.qh @@ -58,7 +58,8 @@ float VerifyKickableEntity(entity client); float VerifyClientEntity(entity client, float must_be_real, float must_be_bots); // if the client is not acceptable, return a string to be used for error messages -string GetClientErrorString(float clienterror, string original_input); +string GetClientErrorString_color(float clienterror, string original_input, string col); +#define GetClientErrorString(clienterror,original_input) GetClientErrorString_color(clienterror,original_input,"^7") // is this entity number even in the possible range of entities? float VerifyClientNumber(float tmp_number); -- 2.39.2