summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2009-09-22 23:53:13 +0000
committerFate <fate-tmw@googlemail.com>2009-09-22 23:53:13 +0000
commit7a33c26814eb38b87f9d32fddb2d63e4b39e69a5 (patch)
tree75ddb192e36f7fd7e390b48362341976f093aebc /src/map
parent264bf4fd6dfb501643cf9178e5471e9e0e55152b (diff)
downloadtmwa-7a33c26814eb38b87f9d32fddb2d63e4b39e69a5.tar.gz
tmwa-7a33c26814eb38b87f9d32fddb2d63e4b39e69a5.tar.bz2
tmwa-7a33c26814eb38b87f9d32fddb2d63e4b39e69a5.tar.xz
tmwa-7a33c26814eb38b87f9d32fddb2d63e4b39e69a5.zip
@listnearby lists all nearby player names
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c33
-rw-r--r--src/map/atcommand.h1
2 files changed, 34 insertions, 0 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index ed213b2..23f1aa8 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -201,6 +201,7 @@ ATCOMMAND_FUNC(log); // [Fate]
ATCOMMAND_FUNC(tee); // [Fate]
ATCOMMAND_FUNC(invisible); // [Fate]
ATCOMMAND_FUNC(visible); // [Fate]
+ATCOMMAND_FUNC(list_nearby); // [Fate]
ATCOMMAND_FUNC(iterate_forward_over_players); // [Fate]
ATCOMMAND_FUNC(iterate_backwards_over_players); // [Fate]
ATCOMMAND_FUNC(wgm);
@@ -334,6 +335,7 @@ static AtCommandInfo atcommand_info[] = {
{ AtCommand_Disablenpc, "@disablenpc", 80, atcommand_disablenpc }, // []
{ AtCommand_ServerTime, "@servertime", 0, atcommand_servertime }, // by Yor
{ AtCommand_CharDelItem, "@chardelitem", 60, atcommand_chardelitem }, // by Yor
+ { AtCommand_ListNearby, "@listnearby", 40, atcommand_list_nearby }, // by Yor
{ AtCommand_Jail, "@jail", 60, atcommand_jail }, // by Yor
{ AtCommand_UnJail, "@unjail", 60, atcommand_unjail }, // by Yor
{ AtCommand_Disguise, "@disguise", 20, atcommand_disguise }, // [Valaris]
@@ -2606,6 +2608,37 @@ int atcommand_killmonster(
return 0;
}
+
+/*==========================================
+ *
+ *------------------------------------------
+ */
+static int atlist_nearby_sub(struct block_list *bl, va_list ap) {
+ char buf[32];
+ int fd = va_arg(ap, int);
+ nullpo_retr(0, bl);
+
+ sprintf (buf, " - \"%s\"", ((struct map_session_data *)bl)->status.name);
+ clif_displaymessage(fd, buf);
+
+ return 0;
+}
+
+/*==========================================
+ *
+ *------------------------------------------
+ */
+int atcommand_list_nearby(
+ const int fd, struct map_session_data* sd,
+ const char* command, const char* message)
+{
+ clif_displaymessage(fd, "Nearby players:");
+ map_foreachinarea(atlist_nearby_sub, sd->bl.m, sd->bl.x-1, sd->bl.y-1, sd->bl.x+1, sd->bl.x+1, BL_PC, fd);
+
+ return 0;
+}
+
+
/*==========================================
*
*------------------------------------------
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index df996b6..5e72b1f 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -182,6 +182,7 @@ enum AtCommandType {
AtCommand_IterateForward,
AtCommand_IterateBackward,
AtCommand_Wgm,
+ AtCommand_ListNearby, // [fate]
// end
AtCommand_Unknown,
AtCommand_MAX