summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/init.c2
-rw-r--r--src/map/script.c12
-rw-r--r--src/map/script.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c
index 94e57b0..8a09c3d 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -92,6 +92,8 @@ HPExport void plugin_init (void)
addScriptCommand("clear", "", clear);
addScriptCommand("changemusic", "ss", changeMusic);
addScriptCommand("setnpcdialogtitle", "s", setNpcDialogTitle);
+ addScriptCommand("getmapname", "", getMapName);
+
do_init_langs();
diff --git a/src/map/script.c b/src/map/script.c
index 97e973d..79e6043 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -699,3 +699,15 @@ BUILDIN(setNpcDialogTitle)
send_changenpc_title(sd, st->oid, name);
return true;
}
+
+BUILDIN(getMapName)
+{
+ TBL_PC *sd = script->rid2sd(st);
+ if (!sd || sd->bl.m == -1)
+ {
+ script_pushstr(st, aStrdup(""));
+ return 1;
+ }
+ script_pushstr(st, aStrdup(map->list[sd->bl.m].name));
+ return 0;
+}
diff --git a/src/map/script.h b/src/map/script.h
index 988b57c..bdd78ec 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -34,5 +34,6 @@ BUILDIN(setAvatarAction);
BUILDIN(clear);
BUILDIN(changeMusic);
BUILDIN(setNpcDialogTitle);
+BUILDIN(getMapName);
#endif // EVOL_MAP_SCRIPT