1 .float centermsg_expire[MAXCENTERMSG];
2 .string centermsg_text[MAXCENTERMSG];
3 .float centermsg_nextdisplay;
5 void centermsg_makedirty()
7 self.centermsg_nextdisplay = time;
10 void centermsg_free(float lineno)
12 if(self.(centermsg_expire[lineno]) > 0)
13 strunzone(self.(centermsg_text[lineno]));
14 self.(centermsg_expire[lineno]) = -1;
15 self.(centermsg_text[lineno]) = "";
16 centermsg_makedirty();
19 void centermsg_freefor(entity p, float lineno)
24 centermsg_free(lineno);
28 void centermsg_set(float lineno, string text)
30 centermsg_free(lineno);
31 self.(centermsg_expire[lineno]) = time + self.cvar_scr_centertime;
32 self.(centermsg_text[lineno]) = strzone(text);
33 centermsg_makedirty();
36 void centermsg_setexpire(float lineno, string text, float expire)
38 centermsg_free(lineno);
39 self.(centermsg_expire[lineno]) = time + self.cvar_scr_centertime * expire;
40 self.(centermsg_text[lineno]) = strzone(text);
41 centermsg_makedirty();
44 void centermsg_setfor(entity p, float lineno, string text)
49 centermsg_set(lineno, text);
53 float centermsg_checkexpire(float lineno)
55 if(self.(centermsg_expire[lineno]) >= 0)
57 if(self.(centermsg_expire[lineno]) < time)
59 centermsg_free(lineno);
74 if(self.cvar_scr_centertime)
75 self.centermsg_nextdisplay = time + self.cvar_scr_centertime * 0.8;
77 for(i = 0; i < MAXCENTERMSG; ++i)
78 if(centermsg_checkexpire(i))
84 out = "\n\n\n\n\n\n\n\n\n\n\n\n\n";
85 for(i = 0; i < MAXCENTERMSG; ++i)
87 out = strcat(out, "^7");
88 if(self.centermsg_expire[i] >= 0)
89 out = strcat(out, self.(centermsg_text[i]));
90 out = strcat(out, "\n");
92 centerprint(self, out);
95 void centermsg_check()
97 if(clienttype(self) != CLIENTTYPE_REAL)
99 if(self.centermsg_nextdisplay && self.centermsg_nextdisplay <= time)
103 void centermsg_reset()
106 self.centermsg_nextdisplay = 0;
107 for(i = 0; i < MAXCENTERMSG; ++i)
109 centerprint(self, "");
112 void centermsg_setall(string s)
115 centerprint(self, s);
116 self.centermsg_nextdisplay = 0;
117 for(i = 0; i < MAXCENTERMSG; ++i)
121 void centermsg_setallfor(entity p, string text)
126 centermsg_setall(text);