COMPLAIN.C
LIB3/D/HOME/CITY/TOWNHALL/COMPLAIN.C · 3.5 KB
From the archive nm4dos.zip
Download the archive « Back to the archive contents
#include "path.h"
inherit "std/room";
static string message, ban;
static int in_use;
setup()
{
set_short("The complaints room");
set_long("A barren looking room with small but very angry "
+"looking thunderclouds buzzing roung the ceiling, this is "
+"where the people of New Moon can come to air their "
+"griefs, and hopefully gain the attention of somebody with "
+"the power to solve all their worries.\n");
add_item( ({"cloud", "thundercloud"}),
"The clouds are dark grey, and occasional flashes of "
+"lightning illuminate them.\n");
add_sign("A sign, much like any other.\n",
"Players can 'complain' here to lodge an official complaint.\n"
+"Creators can also 'banish' names here.\n", "sign", "sign");
set_zone("town hall");
set_light(80);
add_exit("east", "corridor3", "door");
}
void init() {
::init();
add_action("banish", "banish");
add_action("complain", "complain");
}
int banish(string str) {
string str1, temp1;
if(!this_player()->query_creator())
{
notify_fail("Only creators can banish people here. If there is "
+"an offensively named player on the go, inform one of "
+"our invariably friendly creators, and they will banish it for you.\n");
return 0;
}
notify_fail("Usage : banish <name> <reason>\n");
if(!str)
return 0;
if(sscanf(str, "%s %s", str, str1) != 2)
return 0;
str = lower_case(str);
if(sscanf(str,"%s.",temp1))
return 0;
if(sscanf(str, "%s/", temp1))
return 0;
if(file_size("/banish/"+str+".o") >= 0) {
notify_fail("That name is already banished.\n");
return 0;
}
if("secure/login"->test_user(str)) {
notify_fail("That is a player. You must rm or mv the player file first.\n");
return 0;
}
ban = "Banished by : "+(string)this_player()->query_name()+"\n";
ban += ctime(time())+"\n";
ban += "Banish Reason : " + str1 + "\n";
seteuid((string)"secure/master"->get_root_uid());
write_file("/banish/"+str+".o", ban);
seteuid("Room");
write(str + " banished.\n");
return 1;
}
int complain() {
if(this_player()->query_property("guest")) {
return 0;
}
if(in_use) {
write("Sorry, a complaint is currently being posted.\n"+
"Please try again soon or fetch a creator if nobody is here.\n");
return 1;
}
message = this_player()->query_cap_name() + " " + ctime(time()) + "\n";
in_use = 1;
write("You are lodging an official complaint about something or someone.\n"+
"Do not take this action lightly.\n"+
"Please provide as much information as possible and a Lord or God "+
"will mail you regarding the problem as soon as possible. Only "+
"problems that you feel affect the entire mud should be complained "+
"about. Feedback for the general populous will probably end up on "+
"bulletin boards around the place.\n");
write("Enter complaint. ** to end or ~q to abort.\n");
write("] ");
input_to("get_complaint");
return 1;
}
void get_complaint(string str) {
if(str == "~q") {
write("Complaint aborted.\n");
in_use = 0;
message = "";
return;
}
if(str == "**") {
write("Complaint Posted\n");
message += "\n\n";
log_file("COMPLAINTS", message);
message = "";
in_use = 0;
return;
}
message += str + "\n";
write("] ");
input_to("get_complaint");
}
int vote() {
write("No issues up for vote.\n");
return 1;
}