+.float motd_actived_time; // used for both motd and campaign_message
+void PrintWelcomeMessage()
+{
+ if (self.motd_actived_time == 0) { // is there already a message showing?
+ if (autocvar_g_campaign) {
+ if ((self.classname == "player" && self.BUTTON_INFO) || (self.classname != "player")) {
+ self.motd_actived_time = time;
+ Send_CSQC_Centerprint_Generic(self, CPID_MOTD, campaign_message, -1, 0);
+ }
+ } else {
+ if ((time - self.jointime > autocvar_welcome_message_time) && self.BUTTON_INFO) {
+ self.motd_actived_time = time;
+ Send_CSQC_Centerprint_Generic(self, CPID_MOTD, getwelcomemessage(), -1, 0);
+ }
+ }
+ } else { // showing MOTD or campaign message
+ if (autocvar_g_campaign) {
+ if (self.BUTTON_INFO)
+ self.motd_actived_time = time;
+ else if ((time - self.motd_actived_time > 2) && self.classname == "player") { // hide it some seconds after BUTTON_INFO has been released
+ self.motd_actived_time = 0;
+ Send_CSQC_Centerprint_Generic_Expire(self, CPID_MOTD);
+ }
+ } else {
+ if ((time - self.jointime) > autocvar_welcome_message_time) {
+ if (self.BUTTON_INFO)
+ self.motd_actived_time = time;
+ else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
+ self.motd_actived_time = 0;
+ Send_CSQC_Centerprint_Generic_Expire(self, CPID_MOTD);
+ }
+ }
+ }
+ }
+}
+