]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Less spammy centerprint msg shown when one tries to play and the number of players...
authorterencehill <piuntn@gmail.com>
Sat, 10 Sep 2011 19:44:19 +0000 (21:44 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 10 Sep 2011 19:44:19 +0000 (21:44 +0200)
qcsrc/common/constants.qh
qcsrc/server/cl_client.qc

index e13a1071b9be470ba2f4d875cf8a6307b52fce35..fe5f9bcd24ea137c4725726344459305501f179c 100644 (file)
@@ -610,6 +610,7 @@ float CPID_GAME_STARTING = 7;
 float CPID_TIMEOUT_COUNTDOWN = 8;
 float CPID_MOTD = 9;
 float CPID_KH_MSG = 10;
+float CPID_PREVENT_JOIN = 11;
 
 // CSQC centerprint/notify message types
 float MSG_SUICIDE = 0;
index 034a61af73b1986230186afbb85fa28ea48ed74b..914962ca67ccfff1254e93bf5b003bc7ee3f59b2 100644 (file)
@@ -2461,6 +2461,7 @@ void ShowRespawnCountdown()
        }
 }
 
+.float prevent_join_msgtime;
 void LeaveSpectatorMode()
 {
        if(nJoinAllowed(1)) {
@@ -2482,6 +2483,12 @@ void LeaveSpectatorMode()
                        if (time < self.jointime + autocvar_welcome_message_time)
                                Send_CSQC_Centerprint_Generic_Expire(self, CPID_MOTD); // clear MOTD
 
+                       if (self.prevent_join_msgtime)
+                       {
+                               Send_CSQC_Centerprint_Generic_Expire(self, CPID_PREVENT_JOIN);
+                               self.prevent_join_msgtime = 0;
+                       }
+
                        return;
                } else {
                        if (g_ca && self.caplayer) {
@@ -2493,7 +2500,9 @@ void LeaveSpectatorMode()
        }
        else {
                //player may not join because of g_maxplayers is set
-               centerprint(self, PREVENT_JOIN_TEXT);
+               if (time - self.prevent_join_msgtime > 2)
+                       Send_CSQC_Centerprint_Generic(self, CPID_PREVENT_JOIN, PREVENT_JOIN_TEXT, 0, 0);
+               self.prevent_join_msgtime = time;
        }
 }
 
@@ -2604,7 +2613,7 @@ void ObserverThink()
                        }
                }
        }
-       
+
        PrintWelcomeMessage();
 }
 
@@ -2763,7 +2772,7 @@ void PlayerPreThink (void)
        self.usekeypressed = self.BUTTON_USE;
 
        PrintWelcomeMessage();
-       
+
        if(self.classname == "player") {
 //             if(self.netname == "Wazat")
 //                     bprint(self.classname, "\n");