def cmd_lockdown(ch, cmd, arg): '''Usage: lockdown [allowed groups | off] Locks the game for anyone not a member of one of the user groups specified. No argument will list all the user groups locked out of the mud. The off argument will remove all lockdowns.''' if arg == '': lockdown = mudsys.sys_getval("lockdown") if lockdown == '': ch.send("Lockdown is currently off.") else: ch.send("Lockdown is currently to members not of: " + lockdown) ch.send("To turn off lockdown, use {clockdown off{n") elif arg.lower() == "off": ch.send("Lockdown disabled.") mudsys.sys_setval("lockdown", "") # make sure we're not locking ourself out elif not ch.isInGroup(arg): ch.send("You cannot lock yourself out!") else: ch.send("MUD locked down to everyone not in groups: " + arg) mudsys.sys_setval("lockdown", arg) # kick out everyone who we've just locked out for ch in mudchar.char_list(): if ch.is_pc and not ch.isInGroup(arg): ch.send("The mud has just been locked down to you.") mudsys.do_save(ch) mudsys.do_disconnect(ch) extract(ch)
def find_reconnect(name): '''searches through the character list for a PC whose name matches the supplied name''' name = name.lower() for ch in char.char_list(): if ch.is_pc and name == ch.name.lower(): return ch return None