channel.c

foundation2_fluffos_v1/lib/cmds/adm/channel.c · 1.3 KB

From the archive foundation2_fluffos_v1.zip

Download the archive   « Back to the archive contents

/*    /cmd *    from Foundation II
 *    command to handle channel privs
 *    created by Descartes of Borg 940428
 */

#include <lib.h>

inherit LIB_DAEMON;

int cmd(string str) {
    string opt, who, channel;
    object ob;

    if(!str) return 0;
    if(!archp(previous_object())) return 0;
    if(sscanf(str, "%s %s %s", opt, who, channel) != 3) return 0;
    if(!(ob = find_player(who = lower_case(who)))) 
      return notify_fail("No such player online.\n");
    if(opt == "remove") {
        ob->restrict_channel(channel);
        message("system", sprintf("You restrict %s from %s.", capitalize(who),
          channel), this_player());
        message("system",sprintf("You have lost your %s rights.",channel), ob);
        return 1;
    }
    else if(opt == "add") {
        ob->unrestrict_channel(channel);
        message("system", sprintf("You unrestrict %s from %s.", capitalize(who),
          channel), this_player());
        message("system", sprintf("You can now use the %s channel.",
          channel), ob);
        return 1;
    }
    else return 0;
}

void help() {
    message("help", "Syntax: <channel [add|remove] [player] [channel]>\n\n"
      "Used to restrict a player from using a line, or to allow them back "
      "onto that line.", this_player());
}

Site Stats

Snippets: 1791
Codebases: 571