diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-01 23:33:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-01 23:33:37 +0300 |
commit | 6091f2d963bdff2e62176d9a668943ee02f57043 (patch) | |
tree | f8b783ee6d05ee572b3a956f5e2d3cbf6d7fad12 /src | |
parent | 3242c560742518770c6ea97db03bf89d314cb963 (diff) | |
download | plugin-6091f2d963bdff2e62176d9a668943ee02f57043.tar.gz plugin-6091f2d963bdff2e62176d9a668943ee02f57043.tar.bz2 plugin-6091f2d963bdff2e62176d9a668943ee02f57043.tar.xz plugin-6091f2d963bdff2e62176d9a668943ee02f57043.zip |
add script function for check is player dead or not.
New script function: ispcdead()
Diffstat (limited to 'src')
-rw-r--r-- | src/map/init.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 11 | ||||
-rw-r--r-- | src/map/script.h | 1 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/map/init.c b/src/map/init.c index 1685a82..f53de01 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -94,7 +94,7 @@ HPExport void plugin_init (void) addScriptCommand("setnpcdialogtitle", "s", setNpcDialogTitle); addScriptCommand("getmapname", "", getMapName); addScriptCommand("unequipbyid", "i", unequipById); - + addScriptCommand("ispcdead", "", isPcDead); do_init_langs(); diff --git a/src/map/script.c b/src/map/script.c index d225052..fcaf9cc 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -736,3 +736,14 @@ BUILDIN(unequipById) } return true; } + +BUILDIN(isPcDead) +{ + TBL_PC *sd = script->rid2sd(st); + + if (sd == NULL) + return false; + + script_pushint(st, pc_isdead(sd) ? 1 : 0); + return true; +} diff --git a/src/map/script.h b/src/map/script.h index ef3208c..617bd39 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -36,5 +36,6 @@ BUILDIN(changeMusic); BUILDIN(setNpcDialogTitle); BUILDIN(getMapName); BUILDIN(unequipById); +BUILDIN(isPcDead); #endif // EVOL_MAP_SCRIPT |