From 1d98b33ec21827aab21a5afef27c8abf6c510507 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Tue, 11 Mar 2008 05:29:51 +0000 Subject: added motd --- src/game/client/gc_hooks.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/game/client/gc_hooks.cpp') diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index 7d2e1546..0074bab7 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -456,6 +456,8 @@ void extraproj_reset() extraproj_num = 0; } +char server_motd[900] = {0}; + extern "C" void modc_message(int msg) { if(msg == MSG_CHAT) @@ -496,6 +498,31 @@ extern "C" void modc_message(int msg) } } } + else if(msg == MSG_MOTD) + { + const char *message = msg_unpack_string(); + + /* check for errors and invalid inputs */ + if(msg_unpack_error()) + return; + + // process escaping + str_copy(server_motd, message, sizeof(server_motd)); + for(int i = 0; server_motd[i]; i++) + { + if(server_motd[i] == '\\') + { + if(server_motd[i+1] == 'n') + { + server_motd[i] = ' '; + server_motd[i+1] = '\n'; + i++; + } + } + } + + dbg_msg("game", "MOTD: %s", server_motd); + } else if(msg == MSG_SETINFO) { int cid = msg_unpack_int(); -- cgit 1.4.1