1 #include "net_notice.qh"
3 REGISTER_NET_TEMP(TE_CSQC_SVNOTICE)
6 void sv_notice_join_think(entity this)
8 int argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
10 for (int i = 0; i < argc; ++i)
11 sv_notice_to(this, argv(i), autocvar_sv_join_notices_time, false);
14 void sv_notice_join(entity _to)
16 // to-do: make sv_join_notices support per-entry times
17 if (autocvar_sv_join_notices == "") return;
18 defer(_to, 1, sv_notice_join_think);
21 void sv_notice_to(entity _to, string _notice, float _howlong, float _modal)
24 WriteHeader(MSG_ONE, TE_CSQC_SVNOTICE);
25 WriteString(MSG_ONE, _notice);
26 WriteLong(MSG_ONE, _howlong);
27 WriteByte(MSG_ONE, _modal);
30 void sv_notice_toall(string _notice, float _howlong, float _modal)
32 FOREACH_CLIENT(IS_REAL_CLIENT(it), sv_notice_to(it, _notice, _howlong, _modal));
38 NET_HANDLE(TE_CSQC_SVNOTICE, bool isNew)
44 STATIC_INIT(cl_notice)
46 cl_notices = LL_NEW();
50 entity _notice = new_pure(sv_notice);
51 _notice.netname = strzone(ReadString());
52 _notice.alpha = ReadLong() + time;
53 _notice.skin = ReadByte();
54 LL_PUSH(cl_notices, _notice);
60 LL_EACH(cl_notices, it.alpha > time, { flag = true; break; });
65 vector v1 = '1 1 0' * M1;
67 v2.x = vid_conwidth - (2 * M1);
68 v2.y = vid_conheight - (2 * M1);
69 drawfill(v1, v2, '0 0 0', 0.5, DRAWFLAG_NORMAL);
71 v1 = '1 1 0' * (M1 + M2);
72 v2.x = vid_conwidth - (2 * (M1 + M2));
73 v2.y = vid_conheight - (2 * (M1 + M2));
74 drawfill(v1, v2, '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
76 vector v3 = v1 + '10 10 0';
77 #define OUT(s, z) MACRO_BEGIN { drawcolorcodedstring(v3, s, '1 1 0' * z, 1, DRAWFLAG_NORMAL); v3.y += z + 4; } MACRO_END
79 OUT(_("^1Server notices:"), 32);
80 LL_EACH(cl_notices, it.alpha > time, {
81 string s = sprintf(_("^7%s (^3%d sec left)"), it.netname , rint(it.alpha - time));