CheatInitClient();
- // FIXME: .BUTTON_INFO in PrintWelcomeMessage must be checked at every frame, not just here
- PrintWelcomeMessage(self);
+ if(!autocvar_g_campaign)
+ Send_CSQC_Centerprint_Generic(self, CPID_MOTD, getwelcomemessage(), autocvar_welcome_message_time, 0);
}
/*
void() ctf_setstatus;
void() nexball_setstatus;
.float items_added;
+.float motd_actived_time; // used for both motd and campaign_message
void PlayerPreThink (void)
{
WarpZone_PlayerPhysics_FixVAngle();
PlayerUseKey();
self.usekeypressed = self.BUTTON_USE;
+ if (self.motd_actived_time == 0) {
+ if (autocvar_g_campaign) {
+ if (self.classname == "player" && self.BUTTON_INFO) {
+ self.motd_actived_time = time;
+ Send_CSQC_Centerprint_Generic(self, CPID_MOTD, campaign_message, 999, 0);
+ }
+ } else {
+ if ((self.classname == "player" || time - self.jointime > autocvar_welcome_message_time) && self.BUTTON_INFO) {
+ self.motd_actived_time = time;
+ Send_CSQC_Centerprint_Generic(self, CPID_MOTD, getwelcomemessage(), 999, 0);
+ }
+ }
+ } else { // showing MOTD or campaign message
+ if (autocvar_g_campaign) {
+ if (self.classname == "player") {
+ 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(self, CPID_MOTD, "", 1, 0);
+ }
+ }
+ } else {
+ if (self.classname == "player" || (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(self, CPID_MOTD, "", 1, 0);
+ }
+ }
+ }
+ }
+
if(self.classname == "player") {
// if(self.netname == "Wazat")
// bprint(self.classname, "\n");
return versionmsg;
}
-
-void PrintWelcomeMessage(entity pl)
+string getwelcomemessage(void)
{
string s, modifications, motd;
- if(autocvar_g_campaign)
- {
- if(self.classname == "player" && !self.BUTTON_INFO)
- return;
- }
- else
- {
- if((time - self.jointime) > autocvar_welcome_message_time && !self.BUTTON_INFO)
- return;
- }
-
- if(autocvar_g_campaign)
- {
- centerprint(pl, campaign_message);
- return;
- }
-
-//TODO GreEn`mArine: make the timeout-messages clientside as well (just like the ready restart countdown)!
- if(!self.BUTTON_INFO)
- {
- // TODO get rid of this too
- local string specString;
- //if(time < game_starttime) //also show the countdown when being a spectator
- // specString = strcat(specString, "\n\n^1Game starts in ", ftos(ceil(game_starttime - time)), " seconds^7");
- //else
- if (timeoutStatus != 0)
- specString = getTimeoutText(1);
- else
- {
- if(self.classname == "player")
- return;
- goto normal;
- }
- return centerprint(self, specString);
- }
-
-:normal
ret_string = "";
MUTATOR_CALLHOOK(BuildMutatorsPrettyString);
modifications = ret_string;
if (motd != "") {
s = strcat(s, "\n\n^8MOTD: ^7", strreplace("\\n", "\n", motd));
}
- s = strcat(s, "\n");
-
- Send_CSQC_Centerprint_Generic(pl, CPID_MOTD, s, autocvar_welcome_message_time, 0);
+ return s;
}
-
void SetPlayerColors(entity pl, float _color)
{
/*string s;