diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-11 05:29:51 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-11 05:29:51 +0000 |
| commit | 1d98b33ec21827aab21a5afef27c8abf6c510507 (patch) | |
| tree | a0b68f64bd856242833ffcd9265ee091ba53bd58 /src/game/client/gc_hooks.cpp | |
| parent | 6c60f3bcbb8d6c5afd2ef815f8a6307336a86f3d (diff) | |
| download | zcatch-1d98b33ec21827aab21a5afef27c8abf6c510507.tar.gz zcatch-1d98b33ec21827aab21a5afef27c8abf6c510507.zip | |
added motd
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(); |