1 #include "net_notice.qh"
3 REGISTER_NET_TEMP(TE_CSQC_SVNOTICE)
6 void sv_notice_join_think()
9 float argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
13 for(i = argc - 1; i >= 0; --i)
14 sv_notice_to(self.owner, argv(i), autocvar_sv_join_notices_time, false);
21 // to-do: make sv_join_notices support per-entry times
22 if(autocvar_sv_join_notices == "")
27 n.think = sv_notice_join_think;
28 n.nextthink = time + 1;
31 void sv_notice_to(entity _to, string _notice, float _howlong, float _modal)
34 WriteHeader(MSG_ONE, TE_CSQC_SVNOTICE);
35 WriteString(MSG_ONE, _notice);
36 WriteLong(MSG_ONE, _howlong);
37 WriteByte(MSG_ONE, _modal);
40 void sv_notice_toall(string _notice, float _howlong, float _modal)
43 FOR_EACH_REALCLIENT(_head)
44 sv_notice_to(_head, _notice, _howlong, _modal);
51 NET_HANDLE(TE_CSQC_SVNOTICE, bool isNew)
60 entity _notice = new(sv_notice);
61 _notice.netname = strzone(ReadString());
62 _notice.alpha = ReadLong() + time;
63 _notice.skin = ReadByte();
72 _notes = findchain(classname, "sv_notice");
78 vector v1, v2 = '0 0 0', v3;
80 v2_x = vid_conwidth - (2 * M1);
81 v2_y = vid_conheight - (2 * M1);
83 drawfill(v1, v2, '0 0 0', 0.5, DRAWFLAG_NORMAL);
84 v1 = '1 1 0' * (M1 + M2);
85 v2_x = vid_conwidth - (2 * (M1 + M2));
86 v2_y = vid_conheight - (2 * (M1 + M2));
87 drawfill(v1, v2, '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
90 #define OUT(s,z) drawcolorcodedstring(v3, s, '1 1 0' * z, 1, DRAWFLAG_NORMAL); v3_y += z + 4
92 OUT(_("^1Server notices:"), 32);
94 //drawcolorcodedstring(v1 + '5 5 0', "^1Server notices:", '32 32 0', 1, DRAWFLAG_NORMAL);
98 _notice = sprintf(_("^7%s (^3%d sec left)"), _notes.netname , rint(_notes.alpha - time));
104 if(_notes.alpha <= time)
106 _notes.think = SUB_Remove;
107 _notes.nextthink = time;
110 _notes = _notes.chain;