/* Filename : atell.c
* Description : area-tell command
*
* written : 05-10-1996 - Gunner
* last modified : 27-05-1998 - Gunner
* HTML-Version : 04-02-2000 - Ghorwin
*/
#include <mudlib.h>
#include "/doc/crashcourse/defs.h"
inherit I_COMMAND;
#define HELPDIR "/doc/crashcourse/course08/help/"
string
query_action()
{
return "atell";
}
string
short_help()
{
return "This will send a message to all players within a "
"certain area.\n";
}
string
help()
{
return HELPDIR + "atell";
}
static int
main(string arg)
{
object player, room;
int t, num = 0;
string path, message, file;
if (!arg || sscanf(arg,"%s %s",path,message) != 2)
NOT_FAIL("atell <path> <message>\n");
foreach(player in users())
{
room = ENV(player);
if (!room) continue;
file = source_file_name(room);
if (strlen(path) > strlen(file)) continue;
if (file[0..strlen(path)-1] == path)
{
tell_object(player,message+"\n");
tell_object(TP,"The message was sent to: " +
CAP(Q_RNAME(player)) + ".\n");
num++;
}
}
if (!num)
tell_object(TP,"Sorry, no users found in that path.\n");
return 1;
}