summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnieRuru <jeankof@ymail.com>2015-12-21 09:01:59 +0800
committerHaru <haru@dotalux.com>2015-12-22 01:51:57 +0100
commit91c12a9358fe4a30d7b21862efa82e7466e2ab47 (patch)
treeba0dbceff8e63551c0c66fb0c1d9ec28cb32bd6d
parent1c3378e161859ca6da728ea5cb0a5dc07fff5364 (diff)
downloadhercules-91c12a9358fe4a30d7b21862efa82e7466e2ab47.tar.gz
hercules-91c12a9358fe4a30d7b21862efa82e7466e2ab47.tar.bz2
hercules-91c12a9358fe4a30d7b21862efa82e7466e2ab47.tar.xz
hercules-91c12a9358fe4a30d7b21862efa82e7466e2ab47.zip
Update *message script command to allow to use account ID
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--doc/script_commands.txt5
-rw-r--r--src/map/script.c21
2 files changed, 16 insertions, 10 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 852a003b7..7a9481b46 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -4091,11 +4091,12 @@ Note: rid2name may not produce correct character names since rid means
---------------------------------------
+*message <account ID>,"<message>";
*message "<character name>","<message>";
That command will send a message to the chat window of the character
-specified by name. The text will also appear above the head of that
-character. It will not be seen by anyone else.
+specified by account ID or name. The text will also appear above the head
+of that character. It will not be seen by anyone else.
---------------------------------------
diff --git a/src/map/script.c b/src/map/script.c
index fedfc895c..c5bb418d5 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13834,16 +13834,21 @@ BUILDIN(movenpc) {
/*==========================================
* message [MouseJstr]
*------------------------------------------*/
-BUILDIN(message) {
- const char *msg,*player;
- TBL_PC *pl_sd = NULL;
+BUILDIN(message)
+{
+ const char *message;
+ TBL_PC *sd = NULL;
- player = script_getstr(st,2);
- msg = script_getstr(st,3);
+ if (script_isstringtype(st,2))
+ sd = script->nick2sd(st, script_getstr(st,2));
+ else
+ sd = script->id2sd(st, script_getnum(st,2));
- if ((pl_sd = script->nick2sd(st, (char*)player)) == NULL)
+ if (sd == NULL)
return true;
- clif->message(pl_sd->fd, msg);
+
+ message = script_getstr(st,3);
+ clif->message(sd->fd, message);
return true;
}
@@ -20358,7 +20363,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(atcommand,"s"), // [MouseJstr]
BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr]
BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr]
- BUILDIN_DEF(message,"ss"), // [MouseJstr]
+ BUILDIN_DEF(message,"vs"), // [MouseJstr]
BUILDIN_DEF(npctalk,"s?"), // [Valaris]
BUILDIN_DEF(mobcount,"ss"),
BUILDIN_DEF(getlook,"i"),