summaryrefslogtreecommitdiff
path: root/src/map/send.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-01 16:17:42 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-01 16:17:42 +0300
commit856f57d7fb05806cd676112a389ecf8be5ecf54e (patch)
tree7b21a2c6989de6b79d61acaa7d3a1c663a76fd14 /src/map/send.c
parent4284e5bd3d3c3fd387b4e3a9b73220cafc0f2188 (diff)
downloadplugin-856f57d7fb05806cd676112a389ecf8be5ecf54e.tar.gz
plugin-856f57d7fb05806cd676112a389ecf8be5ecf54e.tar.bz2
plugin-856f57d7fb05806cd676112a389ecf8be5ecf54e.tar.xz
plugin-856f57d7fb05806cd676112a389ecf8be5ecf54e.zip
Add script command for send chat command to client.
New script command: clientCommand chatcommand args
Diffstat (limited to 'src/map/send.c')
-rw-r--r--src/map/send.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/map/send.c b/src/map/send.c
index 6fa91fa..b9d826e 100644
--- a/src/map/send.c
+++ b/src/map/send.c
@@ -288,3 +288,18 @@ void send_online_list(int fd, const char *buf, unsigned size)
WFIFOB (fd, size + 4) = 0;
WFIFOSET (fd, len);
}
+
+void send_client_command(TBL_PC *sd, const char *const command)
+{
+ struct SessionExt *data = session_get_bysd(sd);
+ if (!data || data->clientVersion < 8)
+ return;
+
+ const unsigned int len = strlen(command);
+ const int fd = sd->fd;
+ WFIFOHEAD (fd, len);
+ WFIFOW (fd, 0) = 0xb16;
+ WFIFOW (fd, 2) = len + 4;
+ memcpy (WFIFOP (fd, 4), command, len);
+ WFIFOSET (fd, len + 4);
+}