diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-15 17:43:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-15 17:43:49 +0300 |
commit | 77db5d34b091c366750410281369ff4ce926b9b6 (patch) | |
tree | 3aaa39b3f2442fa42e248293b39e74e5fc40f23a /src/map/send.c | |
parent | d8d87bbaf74bf6b013b5cdcd2e9602f1892bbd71 (diff) | |
download | evol-hercules-77db5d34b091c366750410281369ff4ce926b9b6.tar.gz evol-hercules-77db5d34b091c366750410281369ff4ce926b9b6.tar.bz2 evol-hercules-77db5d34b091c366750410281369ff4ce926b9b6.tar.xz evol-hercules-77db5d34b091c366750410281369ff4ce926b9b6.zip |
Impliment script function npctalk3.
Diffstat (limited to 'src/map/send.c')
-rw-r--r-- | src/map/send.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/map/send.c b/src/map/send.c index 9218a21..ccfb052 100644 --- a/src/map/send.c +++ b/src/map/send.c @@ -46,3 +46,25 @@ void send_npccommand2 (struct map_session_data *sd, int npcId, int cmd, int id, WFIFOW (fd, 14) = y; WFIFOSET (fd, 16); } + +void send_local_message(int fd, struct block_list* bl, const char* msg) +{ + unsigned short msg_len = strlen(msg) + 1; + uint8 buf[256]; + if (!bl) + return; + + int len = sizeof(buf) - 8; + if (msg_len > len) + { + ShowWarning("clif_message: Truncating too long message '%s' (len=%u).\n", msg, msg_len); + msg_len = len; + } + + WFIFOHEAD (fd, msg_len + 8); + WBUFW (fd, 0) = 0x8d; + WBUFW (fd, 2) = msg_len + 8; + WBUFL (fd, 4) = bl->id; + safestrncpy((char*)WBUFP(fd, 8), msg, msg_len); + WFIFOSET (fd, msg_len + 8); +} |