summaryrefslogtreecommitdiff
path: root/src/map/script.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/script.c
parent4284e5bd3d3c3fd387b4e3a9b73220cafc0f2188 (diff)
downloadevol-hercules-856f57d7fb05806cd676112a389ecf8be5ecf54e.tar.gz
evol-hercules-856f57d7fb05806cd676112a389ecf8be5ecf54e.tar.bz2
evol-hercules-856f57d7fb05806cd676112a389ecf8be5ecf54e.tar.xz
evol-hercules-856f57d7fb05806cd676112a389ecf8be5ecf54e.zip
Add script command for send chat command to client.
New script command: clientCommand chatcommand args
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index b321541..fd54d5b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -1097,3 +1097,24 @@ BUILDIN(setMount)
return true;
}
+
+BUILDIN(clientCommand)
+{
+ TBL_PC* sd = script->rid2sd(st);
+
+ if (sd == NULL)
+ {
+ ShowWarning("player not attached\n");
+ script->reportsrc(st);
+ return false;
+ }
+ const char *const command = script_getstr(st, 2);
+ if (!command)
+ {
+ ShowWarning("invalid client command\n");
+ script->reportsrc(st);
+ return false;
+ }
+ send_client_command(sd, command);
+ return true;
+}