summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-29 11:49:05 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-29 11:49:05 +0300
commitf7557fca587fac9d7bb410dba724e2c53f3c831a (patch)
tree0f116ec5e3d7a9a80e2a482617b9ab827a6f27aa /src/map/script.c
parent2fbf69ebe75abceb55a66b62bfd4220d3833108d (diff)
downloadplugin-f7557fca587fac9d7bb410dba724e2c53f3c831a.tar.gz
plugin-f7557fca587fac9d7bb410dba724e2c53f3c831a.tar.bz2
plugin-f7557fca587fac9d7bb410dba724e2c53f3c831a.tar.xz
plugin-f7557fca587fac9d7bb410dba724e2c53f3c831a.zip
Add script commands to sit and stand player.
New commands: setpcsit [name,] [0|1] - depend on second parameter set player sit or stand. getpcsit([name]) - return current sit flag.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 86e613e..8b63dd4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -571,4 +571,64 @@ BUILDIN(setNpcSex)
clif->clearunit_area(&nd->bl, CLR_OUTSIGHT);
nd->vd->sex = sex;
clif->spawn(&nd->bl);
+ return true;
+}
+
+BUILDIN(setPcSit)
+{
+ TBL_PC *sd = NULL;
+ int state = 0;
+
+ if (script_hasdata(st, 3))
+ {
+ sd = map->nick2sd (script_getstr(st, 2));
+ state = script_getnum(st, 3);
+ }
+ else if (script_hasdata(st, 2))
+ {
+ sd = script->rid2sd(st);
+ state = script_getnum(st, 2);
+ }
+ else
+ {
+ return false;
+ }
+ if (!sd)
+ return false;
+
+ if (state < 0)
+ state = 0;
+ if (state > 1)
+ state = 1;
+
+ if (!state)
+ {
+ if (pc_issit(sd))
+ {
+ pc->setstand(sd);
+ clif->standing(&sd->bl);
+ }
+ }
+ else if (!pc_issit (sd))
+ {
+ sd->state.dead_sit = 2;
+ sd->vd.dead_sit = 2;
+ clif->sitting(&sd->bl);
+ }
+ return true;
+}
+
+BUILDIN(getPcSit)
+{
+ TBL_PC *sd = NULL;
+
+ if (script_hasdata(st, 2))
+ sd = map->nick2sd (script_getstr(st, 2));
+ else
+ sd = script->rid2sd(st);
+ if (!sd)
+ script_pushint(st, -1);
+ else
+ script_pushint(st, pc_issit (sd));
+ return true;
}