diff options
-rw-r--r-- | src/emap/atcommand.c | 20 | ||||
-rw-r--r-- | src/emap/atcommand.h | 1 | ||||
-rw-r--r-- | src/emap/init.c | 1 |
3 files changed, 21 insertions, 1 deletions
diff --git a/src/emap/atcommand.c b/src/emap/atcommand.c index e7f97b3..f71698f 100644 --- a/src/emap/atcommand.c +++ b/src/emap/atcommand.c @@ -243,7 +243,6 @@ ACMD0(log) ACMD4(tee) { clif->disp_overhead(&sd->bl, message, AREA_CHAT_WOC, NULL); - return true; } @@ -271,3 +270,22 @@ ACMD1(serverExit) return true; } + +ACMD1(getName) +{ + int id = 0; + if (!*message || sscanf(message, "%10d", &id) < 1) + return false; + + const struct block_list* bl = map->id2bl(id); + if (bl == NULL) + { + clif->message(fd, "Unit not found"); + } + else + { + clif->message(fd, status->get_name(bl)); + } + + return true; +} diff --git a/src/emap/atcommand.h b/src/emap/atcommand.h index 5b8588b..50a92df 100644 --- a/src/emap/atcommand.h +++ b/src/emap/atcommand.h @@ -41,5 +41,6 @@ ACMD1(mapExit); ACMD1(serverExit); ACMD0(log); ACMD4(tee); +ACMD4(getName); #endif // EVOL_MAP_ATCOMMAND diff --git a/src/emap/init.c b/src/emap/init.c index e09d551..01e5e19 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -108,6 +108,7 @@ HPExport void plugin_init (void) addAtcommand("linus", linus); addAtcommand("tee", tee); addAtcommand("log", log); + addAtcommand("getname", getName); addCPCommand("serverexit", serverExit); |