/* Filename : mtell.c
* Description : multi-tell command
*
* written : 04-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/"
#define ERRORMSG "'mtell <startlevel> <endlevel> <message>'\n"
string
query_action()
{
return "mtell"; // short for multitell.
}
string
short_help()
{
return "This command will send a message to several players.\n";
}
string
help()
{
return HELPDIR+"mtell";
}
/*
* query_people : A function that returns the names of all people passed
* in the object-array people.
*/
string
query_people(object *people)
{
string names = "";
object player;
foreach(player in people)
names += CAP(player->query_real_name()) + "\n";
return names;
}
/*
* MAIN
*/
static int
main(string arg)
{
int startlevel, endlevel;
object *people;
string message;
if (!arg || sscanf(arg,"%d %d %s",startlevel,endlevel,message) != 3)
NOT_FAIL(ERRORMSG);
people = ranged_users(startlevel,endlevel);
if (sizeof(people) < 1)
NOT_FAIL("No players found within that range, I'm afraid.\n");
tell_object(TP,"You send the following message:\n" + message + "\n"
"to the following people:\n" + query_people(people));
message("tells",message+"\n",people);
return 1;
}