diff options
author | Andrei Karas <akaras@inbox.ru> | 2019-03-01 20:53:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-03-01 20:53:22 +0300 |
commit | 4effbb02d2e656d0d8f33e4337b4b932d6ae8ce7 (patch) | |
tree | bd6bbb83e6f2d9ae3bb78f7447512260fedc2570 | |
parent | d7407de2502d0fda743faf7da0e79995bb017c3b (diff) | |
download | evol-hercules-4effbb02d2e656d0d8f33e4337b4b932d6ae8ce7.tar.gz evol-hercules-4effbb02d2e656d0d8f33e4337b4b932d6ae8ce7.tar.bz2 evol-hercules-4effbb02d2e656d0d8f33e4337b4b932d6ae8ce7.tar.xz evol-hercules-4effbb02d2e656d0d8f33e4337b4b932d6ae8ce7.zip |
Add at command for get name by being id
New gm command: getname ID
-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); |