/* multiplayer command to add/delete names to the list * of checked players */ #include <creator.h> #define MULTIPLAYER "/handlers/multiplayer" inherit COMMAND_BASE; varargs int cmd(string command, string name, string what, string extra) { switch (command) { case "add": if (!call_other(MULTIPLAYER, "add_" + what, name, extra)) { printf("\"%s\" isn't known here.\n", name); } else { printf("\"%s\" added.\n", name); } break; case "del": if(!call_other(MULTIPLAYER, "delete_" + what, name)) { printf("\"%s\" isn't on the list.\n", name); } else { printf("\"%s\" deleted.\n", name); } break; case "log": MULTIPLAYER->mark_log(name, extra); printf("Marked \"multiplay\" playerinfo events for \"%s\" as \"%s\".\n", name, (extra ? extra : "handled")); break; case "list": write("The list currently consists of: $I$5=\n" + query_multiple_short(sort_array(call_other(MULTIPLAYER, "query_" + what), (: strcmp($1, $2) :))) + "$I$0=\n"); break; } return 1; } /* cmd */ mixed *query_patterns() { return ({ "[list]", (: cmd("list", 0, "gits") :), "{allow|list allow}", (: cmd("list", 0, "allowed") :), "add git <word'name'>", (: cmd("add", $4[0], "git") :), "add allowed <word'name'> <word'other name'>", (: cmd("add", $4[0], "allowed", $4[1]) :), "del git <word'name'>", (: cmd("del", $4[0], "git") :), "del allowed <word'name'>", (: cmd("del", $4[0], "allowed") :), "log <word'name'>", (: cmd("log", $4[0], "git") :), "log <word'name'> <string'log text'>", (: cmd("log", $4[0], "git", implode($4[1..], " ")) :) }); }