diff options
-rw-r--r-- | src/map/init.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 39 | ||||
-rw-r--r-- | src/map/script.h | 1 |
3 files changed, 41 insertions, 1 deletions
diff --git a/src/map/init.c b/src/map/init.c index 06002de..f399acf 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -42,7 +42,7 @@ HPExport void plugin_init (void) session = GET_SYMBOL("session"); sockt = GET_SYMBOL("sockt"); - addScriptCommand("setcamnpc", "*", dummy); + addScriptCommand("setcamnpc", "*", setCamNpc); addScriptCommand("restorecam", "", dummy); addScriptCommand("npctalk3", "s", dummy); addScriptCommand("closedialog", "", dummy); diff --git a/src/map/script.c b/src/map/script.c index 1d0f036..585dfec 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11,9 +11,12 @@ #include "../../../common/socket.h" #include "../../../common/strlib.h" #include "../../../map/clif.h" +#include "../../../map/npc.h" #include "../../../map/pc.h" #include "../../../map/script.h" +#include "map/script.h" +#include "map/send.h" #include "map/session.h" #include "map/sessionext.h" @@ -63,3 +66,39 @@ BUILDIN(setLang) getData(); data->language = script_getnum(st, 2); } + +BUILDIN(setCamNpc) +{ + TBL_PC *sd = script->rid2sd(st); + if (!sd) + return 1; + + struct npc_data *nd = NULL; + + int x = 0; + int y = 0; + + if (script_hasdata(st, 2)) + { + nd = npc->name2id (script_getstr(st, 2)); + } + else + { + if (!st->oid) + return 1; + + nd = (struct npc_data *) map->id2bl (st->oid); + } + if (!nd || sd->bl.m != nd->bl.m) + return 1; + + if (script_hasdata(st, 3) && script_hasdata(st, 4)) + { + x = script_getnum(st, 3); + y = script_getnum(st, 4); + } + + send_npccommand2(script->rid2sd (st), st->oid, 2, nd->bl.id, x, y); + + return 0; +} diff --git a/src/map/script.h b/src/map/script.h index 0d0bbda..32a5bec 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -8,5 +8,6 @@ BUILDIN(l); BUILDIN(getClientVersion); BUILDIN(getLang); BUILDIN(setLang); +BUILDIN(setCamNpc); #endif // EVOL_MAP_SCRIPT |