]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add color code handling to GetClientErrorString (example command where it gets called...
authorterencehill <piuntn@gmail.com>
Tue, 3 Feb 2015 00:22:56 +0000 (01:22 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 3 Feb 2015 00:47:14 +0000 (01:47 +0100)
qcsrc/server/command/common.qc
qcsrc/server/command/common.qh

index 09314c745631dc119f5b32341c294c1bb488f148..5b7e761b7879077a18d841119ca0e0e2e4092c93 100644 (file)
@@ -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"; }
        }
 }
index 2a03041d90a56d373b98b36943cc28c9448f1d3e..ac99e32dc46d2583a677e3d687d6a067dde510ee 100644 (file)
@@ -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);