diff options
Diffstat (limited to 'src/game/client/gc_hooks.cpp')
| -rw-r--r-- | src/game/client/gc_hooks.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
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(); |