From 91c12a9358fe4a30d7b21862efa82e7466e2ab47 Mon Sep 17 00:00:00 2001 From: AnnieRuru Date: Mon, 21 Dec 2015 09:01:59 +0800 Subject: Update *message script command to allow to use account ID Signed-off-by: Haru --- doc/script_commands.txt | 5 +++-- src/map/script.c | 21 +++++++++++++-------- 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 ,""; *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"), -- cgit v1.2.3-60-g2f50