diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-15 14:36:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-15 14:36:53 +0300 |
commit | 709a4632333657ac6e12c427843d07d3198f68d7 (patch) | |
tree | cc6e1e0276df0e0fe5ffa2f85e1e17c150543147 /src/map/script.c | |
parent | 8fe6b497e0bce5999973321fbde89ff080647c8b (diff) | |
download | plugin-709a4632333657ac6e12c427843d07d3198f68d7.tar.gz plugin-709a4632333657ac6e12c427843d07d3198f68d7.tar.bz2 plugin-709a4632333657ac6e12c427843d07d3198f68d7.tar.xz plugin-709a4632333657ac6e12c427843d07d3198f68d7.zip |
Impliment script command setcamnpc.
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 39 |
1 files changed, 39 insertions, 0 deletions
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; +} |