Server now uses Send_CSQC_Centerprint_Generic instead of centerprint_builtin to send messages, so that it's possible to send more parameters (id, duration and countdown_num) without adding them to the msg (like the id before). If duration is not set, then the default duration will be used, that is hud_panel_centerprint_time.
In the countdown case, the server can send only the first msg of a series with the same id and the client can continue the countdown by its own; the next countdown messages can be sent by the server anyway, for example to change the countdown msg or for whatever reason. Countdown can be stopped by the server at any time by sending an empty msg (always same id).
The centerprint function in the client now is a wrapper for centerprint_generic, which actually handles the new parameters and add the msgs to the list.
Changes on minstagib_ammocheck are neccessary to correctly stop the out of ammo countdown.
Still other work to do anyway...
{
HUD_Centerprint(ReadString(), ReadString(), ReadShort(), ReadByte());
}
+ else if(type == CSQC_CENTERPRINT_GENERIC)
+ {
+ // id string time countdown_num
+ float id;
+ id = ReadByte();
+ if (id == 0)
+ centerprint_generic(id, ReadString(), 0, 0);
+ else
+ centerprint_generic(id, ReadString(), ReadByte(), ReadByte());
+ }
}
void Net_WeaponComplain() {
string centerprint_messages[CENTERPRINT_MAX_MSGS];
float centerprint_msgID[CENTERPRINT_MAX_MSGS];
float centerprint_time[CENTERPRINT_MAX_MSGS];
+float centerprint_expire_time[CENTERPRINT_MAX_MSGS];
+float centerprint_countdown_num[CENTERPRINT_MAX_MSGS];
-string msg_without_CPID(string s)
-{
- return substring(s, strstrofs(s, " ", 0) + 1, strlen(s));
-}
-float get_CPID(string s)
-{
- if(substring(s, 0, 1) != "\r")
- return 0;
- return stof(substring(s, 1, strstrofs(s, " ", 0)));
-}
-void centerprint(string strMessage)
+void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num)
{
float i, j;
- if(autocvar_hud_panel_centerprint_time <= 0)
+ if(strMessage == "" && new_id == 0)
return;
- if(strMessage == "")
- return;
-
- float new_id = get_CPID(strMessage);
+ if(duration == 0)
+ duration = autocvar_hud_panel_centerprint_time;
for (i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
{
if (j == CENTERPRINT_MAX_MSGS)
j = 0;
- if (new_id && new_id == centerprint_msgID[j] && centerprint_time[j] + autocvar_hud_panel_centerprint_time >= time)
+ if (new_id && new_id == centerprint_msgID[j]) // && centerprint_expire_time[j] >= time
{
if(centerprint_messages[j])
strunzone(centerprint_messages[j]);
- centerprint_messages[j] = strzone(msg_without_CPID(strMessage));
- centerprint_time[j] = time;
+ centerprint_messages[j] = strzone(strMessage);
+
+ centerprint_time[j] = duration;
+ centerprint_expire_time[j] = time + duration;
+ centerprint_countdown_num[j] = countdown_num;
return;
}
if(centerprint_messages[j] == strMessage)
{
- centerprint_time[j] = time;
centerprint_msgID[j] = new_id;
+
+ centerprint_time[j] = duration;
+ centerprint_expire_time[j] = time + duration;
+ centerprint_countdown_num[j] = countdown_num;
return;
}
}
cpm_index = CENTERPRINT_MAX_MSGS - 1;
if(centerprint_messages[cpm_index])
strunzone(centerprint_messages[cpm_index]);
- if (new_id)
- centerprint_messages[cpm_index] = strzone(msg_without_CPID(strMessage));
- else
- centerprint_messages[cpm_index] = strzone(strMessage);
+ centerprint_messages[cpm_index] = strzone(strMessage);
centerprint_msgID[cpm_index] = new_id;
- centerprint_time[cpm_index] = time;
+ centerprint_time[cpm_index] = duration;
+ centerprint_expire_time[cpm_index] = time + duration;
+ centerprint_countdown_num[cpm_index] = countdown_num;
+}
+
+void centerprint(string strMessage)
+{
+ centerprint_generic(0, strMessage, autocvar_hud_panel_centerprint_time, 0);
}
// CenterPrint (#16)
{
if (j == CENTERPRINT_MAX_MSGS)
j = 0;
- if (centerprint_time[j] + autocvar_hud_panel_centerprint_time < time)
- continue;
- else if (centerprint_time[j] + autocvar_hud_panel_centerprint_time - fade > time)
+ if (centerprint_expire_time[j] < time)
+ {
+ if (centerprint_countdown_num[j])
+ {
+ centerprint_countdown_num[j] = centerprint_countdown_num[j] - 1;
+ if (centerprint_countdown_num[j] == 0)
+ continue;
+ centerprint_expire_time[j] = centerprint_expire_time[j] + centerprint_time[j];
+ }
+ else
+ continue;
+ }
+ if (centerprint_expire_time[j] - fade > time)
{
a = 1 * alpha_factor;
sz = 1;
}
- else if (centerprint_time[j] + autocvar_hud_panel_centerprint_time > time)
+ else if (centerprint_expire_time[j] > time)
{
- a = (centerprint_time[j] + autocvar_hud_panel_centerprint_time - time) / fade * alpha_factor;
+ a = (centerprint_expire_time[j] - time) / fade * alpha_factor;
sz = 0.8 + a * (1 - 0.8);
}
drawfontscale = sz * '1 1 0';
- n = tokenizebyseparator(centerprint_messages[j], "\n");
+ if (centerprint_countdown_num[j])
+ n = tokenizebyseparator(sprintf(centerprint_messages[j], centerprint_countdown_num[j]), "\n");
+ else
+ n = tokenizebyseparator(centerprint_messages[j], "\n");
if (autocvar_hud_panel_centerprint_flip)
{
// check if the message can be entirely shown
if (autocvar_hud_panel_centerprint_flip)
{
pos_y = next_msg_pos_y;
- if (a < 1)
+ if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
pos_y += 1.5 * fontsize_y * (1 - a*a);
}
else
{
- if (a < 1)
+ if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
pos_y -= 1.5 * fontsize_y * (1 - a*a);
}
drawfontscale = '1 1 0';
vector camera_direction;
void centerprint(string strMessage);
+void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num);
#define ALPHA_MIN_VISIBLE 0.003
countdown_rounded = floor(0.5 + countdown);
if(countdown <= 0) {
if (!spectatee_status) //do cprint only for players
- centerprint(strcat(CPID_GAME_STARTING, _("^1Begin!")));
+ centerprint_generic(CPID_GAME_STARTING, _("^1Begin!"), 1, 0);
sound(world, CHAN_AUTO, strcat("announcer/", autocvar_cl_announcer, "/begin.wav"), VOL_BASEVOICE, ATTN_NONE);
//reset maptime announcers now as well
}
else {
if (!spectatee_status) //do cprint only for players
- centerprint(strcat(CPID_GAME_STARTING, sprintf(_("^1Game starts in %d seconds"), countdown_rounded)));
+ centerprint_generic(CPID_GAME_STARTING, _("^1Game starts in %d seconds"), 1, countdown_rounded);
if(countdown_rounded <= 3 && countdown_rounded >= 1) {
sound(world, CHAN_AUTO, strcat("announcer/", autocvar_cl_announcer, "/", ftos(countdown_rounded), ".wav"), VOL_BASEVOICE, ATTN_NONE);
const float CSQC_KILLNOTIFY = 0;
const float CSQC_CENTERPRINT = 1;
+const float CSQC_CENTERPRINT_GENERIC = 2;
const float ENT_CLIENT = 0;
const float ENT_CLIENT_DEAD = 1;
float MAX_SHOT_DISTANCE = 32768;
//centerprint ID list
-#define CPID_TEAMCHANGE "\r1 "
-#define CPID_KILL "\r2 "
-#define CPID_MINSTA_FINDAMMO "\r3 "
-#define CPID_NIX_WPNCHANGE "\r4 "
-#define CPID_DISCONNECT_IDLING "\r5 "
-#define CPID_ROUND_STARTING "\r6 "
-#define CPID_GAME_STARTING "\r7 "
-#define CPID_TIMEOUT_COUNTDOWN "\r8 "
-#define CPID_MOTD "\r9 "
+float CPID_TEAMCHANGE = 1;
+float CPID_KILL = 2;
+float CPID_MINSTA_FINDAMMO = 3;
+float CPID_NIX_WPNCHANGE = 4;
+float CPID_DISCONNECT_IDLING = 5;
+float CPID_ROUND_STARTING = 6;
+float CPID_GAME_STARTING = 7;
+float CPID_TIMEOUT_COUNTDOWN = 8;
+float CPID_MOTD = 9;
// CSQC centerprint/notify message types
float MSG_SUICIDE = 0;
if (g_ca)
allowed_to_spawn = 1;
if(champion && g_arena)
+ {
msg = strcat("The Champion is ", champion_name, "^7\n");
+ FOR_EACH_PLAYER(e)
+ centerprint(e, msg); // TODO: send this msg only once
+ }
if(f != roundStartTime_prev) {
- msg = strcat(CPID_ROUND_STARTING, msg, "Round will start in ", ftos(f),"\n");
roundStartTime_prev = f;
if(f == 5)
Announce("prepareforbattle");
else if(f == 1)
Announce("1");
- FOR_EACH_PLAYER(e)
- centerprint(e, msg);
+ FOR_EACH_PLAYER(e)
+ Send_CSQC_Centerprint_Generic(e, CPID_ROUND_STARTING, "Round will start in %d\n", 1, f); // TODO: send this msg only once
}
if (g_arena) {
{
roundStartTime_prev = f;
Announce("begin");
- centerprint(self, strcat(CPID_ROUND_STARTING, "^1Begin!\n"));
+ Send_CSQC_Centerprint_Generic(e, CPID_ROUND_STARTING, "^1Begin!\n", 1, 0);
if(g_ca) {
ca_players = 0;
DropAllRunes(self);
MUTATOR_CALLHOOK(MakePlayerObserver);
+ if (g_minstagib)
+ minstagib_stop_countdown();
+
Portal_ClearAll(self);
if(self.alivetime)
{
if(self.cnt <= 10)
AnnounceTo(self.owner, strcat(ftos(self.cnt), ""));
+ // TODO: Send_CSQC_Centerprint_Generic only once
if(self.owner.killindicator_teamchange)
{
if(self.owner.killindicator_teamchange == -1)
- centerprint(self.owner, strcat(CPID_TEAMCHANGE, "Changing team in ", ftos(self.cnt), " seconds"));
+ Send_CSQC_Centerprint_Generic(self.owner, CPID_TEAMCHANGE, "Changing team in %d seconds", 1, self.cnt);
else if(self.owner.killindicator_teamchange == -2)
- centerprint(self.owner, strcat(CPID_TEAMCHANGE, "Spectating in ", ftos(self.cnt), " seconds"));
+ Send_CSQC_Centerprint_Generic(self.owner, CPID_TEAMCHANGE, "Spectating in %d seconds", 1, self.cnt);
else
- centerprint(self.owner, strcat(CPID_TEAMCHANGE, "Changing to ", ColoredTeamName(self.owner.killindicator_teamchange), " in ", ftos(self.cnt), " seconds"));
+ Send_CSQC_Centerprint_Generic(self.owner, CPID_TEAMCHANGE, strcat("Changing to ", ColoredTeamName(self.owner.killindicator_teamchange), " in %d seconds"), 1, self.cnt);
}
else
- centerprint(self.owner, strcat(CPID_KILL, "^1Suicide in ", ftos(self.cnt), " seconds"));
+ Send_CSQC_Centerprint_Generic(self.owner, CPID_KILL, "^1Suicide in %d seconds", 1, self.cnt);
}
self.nextthink = time + 1;
self.cnt -= 1;
bprint("\n");
- self.welcomemessage_time = 0;
-
stuffcmd(self, strcat(clientstuff, "\n"));
stuffcmd(self, strcat("exec maps/", mapname, ".cfg\n"));
stuffcmd(self, "cl_particles_reloadeffects\n");
set_dom_state(self);
CheatInitClient();
+
+ // FIXME: .BUTTON_INFO in PrintWelcomeMessage must be checked at every frame, not just here
+ PrintWelcomeMessage(self);
}
/*
else {
retStr = strcat("Timeout begins in ", ftos(remainingLeadTime), " seconds!\n");
}
- return strcat(CPID_TIMEOUT_COUNTDOWN, retStr);
+ return retStr;
}
else if (timeoutStatus == 2) {
if (addOneSecond) {
retStr = strcat("Timeout ends in ", ftos(remainingTimeoutTime + 1), " seconds!\n");
//don't show messages like "Timeout ends in 0 seconds"...
if ((remainingTimeoutTime + 1) > 0)
- return strcat(CPID_TIMEOUT_COUNTDOWN, retStr);
+ return retStr;
else
- return strcat(CPID_TIMEOUT_COUNTDOWN, "");
+ return "";
}
else {
retStr = strcat("Timeout ends in ", ftos(remainingTimeoutTime), " seconds!\n");
//don't show messages like "Timeout ends in 0 seconds"...
if ((remainingTimeoutTime) > 0)
- return strcat(CPID_TIMEOUT_COUNTDOWN, retStr);
+ return retStr;
else
- return strcat(CPID_TIMEOUT_COUNTDOWN, "");
+ return "";
}
}
else return "";
bprint ("^4", self.netname, "^4 is playing now\n");
if(!autocvar_g_campaign)
- centerprint(self, CPID_MOTD); // clear MOTD
+ Send_CSQC_Centerprint_Generic(self, CPID_MOTD, "", 1, 0); // clear MOTD
return;
} else {
}
}
}
- PrintWelcomeMessage(self);
}
void SpectatorThink()
}
}
- PrintWelcomeMessage(self);
self.flags |= FL_CLIENT | FL_NOTARGET;
}
CheckRules_Player();
- PrintWelcomeMessage(self);
-
if (intermission_running)
{
IntermissionThink (); // otherwise a button could be missed between
if(autocvar_g_balance_nex_charge_rot_rate && self.nex_charge > autocvar_g_balance_nex_charge_limit && self.nex_charge_rottime < time)
self.nex_charge = bound(autocvar_g_balance_nex_charge_limit, self.nex_charge - autocvar_g_balance_nex_charge_rot_rate * frametime / W_TICSPERFRAME, 1);
- if(frametime)
- player_anim();
-
if (g_minstagib)
minstagib_ammocheck();
+ if(frametime)
+ player_anim();
+
if(g_ctf)
ctf_setstatus();
{
if(timeleft != self.idlekick_lasttimeleft)
{
- centerprint_atprio(self, CENTERPRIO_IDLEKICK, strcat(CPID_DISCONNECT_IDLING, "^3Stop idling!\n^3Disconnecting in ", ftos(timeleft), "..."));
+ // TODO: send this msg only once
+ Send_CSQC_Centerprint_Generic(self, CPID_DISCONNECT_IDLING, "^3Stop idling!\n^3Disconnecting in %d seconds...", 1, timeleft);
AnnounceTo(self, strcat(ftos(timeleft), ""));
}
}
else
{
- centerprint_expire(self, CENTERPRIO_IDLEKICK);
+ Send_CSQC_Centerprint_Generic(self, CPID_DISCONNECT_IDLING, "", 1, timeleft);
}
self.idlekick_lasttimeleft = timeleft;
}
string w_deathtypestring;
-void(entity client, string s) centerprint_builtin = #73;
+// void(entity client, string s) centerprint_builtin = #73;
.vector dest1, dest2;
float gameover;
void timeoutHandler_Think() {
local string timeStr;
local entity plr;
+ // NOTE: the below Send_CSQC_Centerprint_Generic send msgs with countdown_num
+ // parameter set as 0, even if the msgs are part of a countdown
if (timeoutStatus == 1) {
if (remainingLeadTime > 0) {
//centerprint the information to every player
timeStr = getTimeoutText(0);
FOR_EACH_REALCLIENT(plr) {
if(plr.classname == "player") {
- centerprint_atprio(plr, CENTERPRIO_SPAM, timeStr);
+ Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, timeStr, 1, 0);
}
}
remainingLeadTime -= 1;
timeStr = getTimeoutText(0);
FOR_EACH_REALCLIENT(plr) {
if(plr.classname == "player") {
- centerprint_atprio(plr, CENTERPRIO_SPAM, timeStr);
+ Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, timeStr, 1, 0);
}
}
if(remainingTimeoutTime == autocvar_sv_timeout_resumetime) { //play a warning sound when only <sv_timeout_resumetime> seconds are left
//get rid of the countdown message
FOR_EACH_REALCLIENT(plr) {
if(plr.classname == "player") {
- centerprint_atprio(plr, CENTERPRIO_SPAM, "");
+ Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, "", 1, 0);
}
}
remove(self);
else if (timeoutStatus == 0) { //if a player called the resumegame command (which set timeoutStatus to 0 already)
FOR_EACH_REALCLIENT(plr) {
if(plr.classname == "player") {
- centerprint_atprio(plr, CENTERPRIO_SPAM, "");
+ Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, "", 1, 0);
}
}
remove(self);
#define CENTERPRIO_ADMIN 99
.float centerprint_priority;
.float centerprint_expires;
+void Send_CSQC_Centerprint_Generic(entity e, float id, string s1, float duration, float countdown_num);
void centerprint_atprio(entity e, float prio, string s)
{
if (intermission_running)
e.centerprint_expires = time + (e.cvar_hud_panel_centerprint_time * TIMEOUT_SLOWMO_VALUE);
else
e.centerprint_expires = time + e.cvar_hud_panel_centerprint_time;
- centerprint_builtin(e, s);
+ // centerprint_builtin(e, s);
+ Send_CSQC_Centerprint_Generic(e, 0, s, 0, 0);
}
}
void centerprint_expire(entity e, float prio)
if (prio == e.centerprint_priority)
{
e.centerprint_priority = 0;
- centerprint_builtin(e, "");
+ // centerprint_builtin(e, "");
+ Send_CSQC_Centerprint_Generic(e, 0, "", 0, 0);
}
}
void centerprint(entity e, string s)
#define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement)
#define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0
+
+void Send_CSQC_Centerprint_Generic(entity e, float id, string s1, float duration, float countdown_num)
+{
+ if (clienttype(e) == CLIENTTYPE_REAL)
+ {
+ msg_entity = e;
+ WRITESPECTATABLE_MSG_ONE({
+ WriteByte(MSG_ONE, SVC_TEMPENTITY);
+ WriteByte(MSG_ONE, TE_CSQC_NOTIFY);
+ WriteByte(MSG_ONE, CSQC_CENTERPRINT_GENERIC);
+ WriteByte(MSG_ONE, id);
+ WriteString(MSG_ONE, s1);
+ if (id != 0)
+ {
+ WriteByte(MSG_ONE, duration);
+ WriteByte(MSG_ONE, countdown_num);
+ }
+ });
+ }
+}
// WARNING: this kills the trace globals
#define EXACTTRIGGER_TOUCH if(WarpZoneLib_ExactTrigger_Touch()) return
#define EXACTTRIGGER_INIT WarpZoneLib_ExactTrigger_Init()
if(dt >= 1 && dt <= 5)
self.nix_lastinfotime = -42;
else
- centerprint(self, strcat(CPID_NIX_WPNCHANGE, "\n\n^2Active weapon: ^3", W_Name(nix_weapon)));
+ Send_CSQC_Centerprint_Generic(self, CPID_NIX_WPNCHANGE, strcat("^2Active weapon: ^3", W_Name(nix_weapon)), 2, dt);
}
if(self.nix_lastinfotime != dt)
{
self.nix_lastinfotime = dt; // initial value 0 should count as "not seen"
if(dt >= 1 && dt <= 5)
- centerprint(self, strcat(CPID_NIX_WPNCHANGE, "^3", ftos(dt), "^2 seconds until weapon change...\n\nNext weapon: ^3", W_Name(nix_nextweapon), "\n"));
+ Send_CSQC_Centerprint_Generic(self, CPID_NIX_WPNCHANGE, strcat("^3%d^2 seconds until weapon change...\n\nNext weapon: ^3", W_Name(nix_nextweapon), "\n"), 1, dt); // TODO: send this msg only once
}
if(!(self.items & IT_UNLIMITED_WEAPON_AMMO) && time > self.nix_nextincr)
{
pickedup = TRUE;
// play some cool sounds ;)
- centerprint(player, CPID_MINSTA_FINDAMMO); //clear countdown
if (clienttype(player) == CLIENTTYPE_REAL)
{
if(player.health <= 5)
{
string s, modifications, motd;
- if(self.cvar_hud_panel_centerprint_time == 0) return;
-
if(autocvar_g_campaign)
{
if(self.classname == "player" && !self.BUTTON_INFO)
return;
}
- if( !(timeoutStatus >= 1) ) { //really print the WelcomeMessage to the player every frame when timeout-seconds are shown or the game is restarted, to make sure that the shown number is accurate
- if(self.welcomemessage_time > time) return;
- self.welcomemessage_time = time + max(0.5, self.cvar_hud_panel_centerprint_time * 0.6);
- }
-
if(autocvar_g_campaign)
{
centerprint(pl, campaign_message);
return;
goto normal;
}
- return centerprint_atprio(self, CENTERPRIO_SPAM, specString);
+ return centerprint_atprio(self, CENTERPRIO_SPAM, specString); // TODO: convert to Send_CSQC_Centerprint_Generic(self, CPID_TIMEOUT_COUNTDOWN, ...
}
:normal
local string versionmessage;
versionmessage = GetClientVersionMessage();
- s = strcat(CPID_MOTD, "This is Xonotic ", autocvar_g_xonoticversion, "\n", versionmessage);
+ s = strcat("This is Xonotic ", autocvar_g_xonoticversion, "\n", versionmessage);
s = strcat(s, "^8\n\nmatch type is ^1", gamemode_name, "^8\n");
if(modifications != "")
}
s = strcat(s, "\n");
- centerprint(pl, s);
+ Send_CSQC_Centerprint_Generic(pl, CPID_MOTD, s, autocvar_welcome_message_time, 0);
}
.float minstagib_nextthink;
-void minstagib_ammocheck (void)
+.float minstagib_needammo;
+void minstagib_stop_countdown(void)
{
- if (time < self.minstagib_nextthink || self.deadflag || gameover)
+ if (self.minstagib_needammo)
+ {
+ self.health = 100;
+ Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "", 1, 0);
+ }
+ self.minstagib_needammo = FALSE;
+}
+void minstagib_ammocheck(void)
+{
+ if (time < self.minstagib_nextthink)
return;
- if (self.ammo_cells <= 0)
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ if (self.deadflag || gameover || self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO))
+ minstagib_stop_countdown();
+ else
{
+ self.minstagib_needammo = TRUE;
if (self.health == 5)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "you're dead now...\n"));
Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "terminated");
}
else if (self.health == 10)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "^11^7 second left to find some ammo\n"));
Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "1");
}
else if (self.health == 20)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "^12^7 seconds left to find some ammo\n"));
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "2");
}
else if (self.health == 30)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "^13^7 seconds left to find some ammo\n"));
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "3");
}
else if (self.health == 40)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "^14^7 seconds left to find some ammo\n"));
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "4");
}
else if (self.health == 50)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "^15^7 seconds left to find some ammo\n"));
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "5");
}
else if (self.health == 60)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "^36^7 seconds left to find some ammo\n"));
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "6");
}
else if (self.health == 70)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "^37^7 seconds left to find some ammo\n"));
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "7");
}
else if (self.health == 80)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "^38^7 seconds left to find some ammo\n"));
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "8");
}
else if (self.health == 90)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "^39^7 seconds left to find some ammo\n"));
+ Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "^1%d^7 second left to find some ammo", 1, 9);
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
AnnounceTo(self, "9");
}
else if (self.health == 100)
{
- centerprint(self, strcat(CPID_MINSTA_FINDAMMO, "get some ammo or\nyou'll be dead in ^310^7 seconds..."));
+ Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "get some ammo or\nyou'll be dead in ^3%d^7 seconds...", 1, 10);
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
if not(self.flags & FL_GODMODE)
AnnounceTo(self, "10");