diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-28 22:45:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-28 22:45:51 +0300 |
commit | 93dc75d5f5a5fedf9893778604443becd6926a32 (patch) | |
tree | 65f144aa347c64852e8a45b38c35d9f7d4f6d0b6 /src/emap/script.c | |
parent | 1cba537b28b4c0fd6edb1f4f30e4457fd441b6c9 (diff) | |
download | evol-hercules-93dc75d5f5a5fedf9893778604443becd6926a32.tar.gz evol-hercules-93dc75d5f5a5fedf9893778604443becd6926a32.tar.bz2 evol-hercules-93dc75d5f5a5fedf9893778604443becd6926a32.tar.xz evol-hercules-93dc75d5f5a5fedf9893778604443becd6926a32.zip |
Add chatjoin script command for join chat room.
Format: chatjoin chat [,user [,password]]
Diffstat (limited to 'src/emap/script.c')
-rw-r--r-- | src/emap/script.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/emap/script.c b/src/emap/script.c index 469e9bc..33f5d60 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -14,6 +14,7 @@ #include "common/socket.h" #include "common/strlib.h" #include "common/timer.h" +#include "map/chat.h" #include "map/chrif.h" #include "map/clif.h" #include "map/npc.h" @@ -1689,3 +1690,36 @@ BUILDIN(setBgTeam) data->teamId = teamId; return true; } + +// chatjoin chatId [,char [,password]] +BUILDIN(chatJoin) +{ + int chatId = script_getnum(st, 2); + TBL_PC *sd = NULL; + const char *password = ""; + if (script_hasdata(st, 4)) + { + if (script_isstringtype(st, 3)) + sd = map->nick2sd(script_getstr(st, 3)); + if (script_isstringtype(st, 4)) + password = script_getstr(st, 4); + } + else if (script_hasdata(st, 3)) + { + if (script_isstringtype(st, 3)) + sd = map->nick2sd(script_getstr(st, 3)); + } + else + { + sd = script->rid2sd(st); + } + if (!sd) + { + ShowWarning("player not found\n"); + script->reportsrc(st); + return false; + } + + chat->join(sd, chatId, password); + return true; +} |