]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Update an old function designed to give advanced information about frag messages
authorSamual <samual@xonotic.org>
Mon, 15 Aug 2011 21:52:58 +0000 (17:52 -0400)
committerSamual <samual@xonotic.org>
Mon, 15 Aug 2011 21:52:58 +0000 (17:52 -0400)
qcsrc/server/miscfunctions.qc

index 5797effcd333bf2cc581a542606140c4b32cfb99..9b0324755a41669bc1b6d0a750a306d45d481bba 100644 (file)
@@ -81,19 +81,20 @@ float logfile;
 
 string GetAdvancedDeathReports(entity enPlayer) // Extra fragmessage information
 {
-       local float nPlayerHealth = rint(enPlayer.health);
-       local float nPlayerArmor = rint(enPlayer.armorvalue);
-       local float nPlayerHandicap = enPlayer.cvar_cl_handicap;
-       local float nPlayerPing = rint(enPlayer.ping);
-       local string strPlayerPingColor;
-       local string strMessage;
+       float nPlayerHealth = rint(enPlayer.health);
+       float nPlayerArmor = rint(enPlayer.armorvalue);
+       float nPlayerHandicap = enPlayer.cvar_cl_handicap;
+       float nPlayerPing = rint(enPlayer.ping);
+       string strPlayerPingColor;
+       string strMessage;
+       
        if(nPlayerPing >= 150)
                strPlayerPingColor = "^1";
        else
                strPlayerPingColor = "^2";
 
        if((autocvar_sv_fragmessage_information_stats) && (enPlayer.health >= 1))
-               strMessage = strcat(strMessage, "\n^7(Health ^1", ftos(nPlayerHealth), "^7 / Armor ^2", ftos(nPlayerArmor), "^7)");
+               strMessage = strcat(strMessage, "^7(Health ^1", ftos(nPlayerHealth), "^7 / Armor ^2", ftos(nPlayerArmor), "^7)");
 
        if(autocvar_sv_fragmessage_information_ping) {
                if(clienttype(enPlayer) == CLIENTTYPE_BOT) // Bots have no ping
@@ -113,12 +114,16 @@ string GetAdvancedDeathReports(entity enPlayer) // Extra fragmessage information
        } else if(autocvar_sv_fragmessage_information_handicap) {
                if(autocvar_sv_fragmessage_information_handicap == 2)
                        if(nPlayerHandicap <= 1)
-                               strMessage = strcat(strMessage, "\n^7(Handicap ^2Off^7)");
+                               strMessage = strcat(strMessage, "^7(Handicap ^2Off^7)");
                        else
-                               strMessage = strcat(strMessage, "\n^7(Handicap ^2", ftos(nPlayerHandicap), "^7)");
+                               strMessage = strcat(strMessage, "^7(Handicap ^2", ftos(nPlayerHandicap), "^7)");
                else if(nPlayerHandicap > 1)
-                       strMessage = strcat(strMessage, "\n^7(Handicap ^2", ftos(nPlayerHandicap), "^7)");
+                       strMessage = strcat(strMessage, "^7(Handicap ^2", ftos(nPlayerHandicap), "^7)");
        }
+       
+       if(strMessage) // add new line to the beginning if there is a message
+               strMessage = strcat("\n", strMessage);
+               
        return strMessage;
 }
 void bcenterprint(string s)