From: terencehill Date: Tue, 3 Feb 2015 00:22:56 +0000 (+0100) Subject: Add color code handling to GetClientErrorString (example command where it gets called... X-Git-Tag: xonotic-v0.8.1~131^2 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=eeb8861532ca5ac4cc58ef74f390cc8f64e6e06e;p=xonotic%2Fxonotic-data.pk3dir.git Add color code handling to GetClientErrorString (example command where it gets called: tell ^1wrong_player_name blabla) --- 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);