@verb #17:"@shutdown" any any any rdo #55 @program #17:"@shutdown" any any any if (!player.wizard) return $msg:mtell("huh") elseif ($shutdown_task && $code_utils:task_valid($shutdown_task)) return player:notify("Shutdown already in progress.") endif if (s = match(argstr, "^in +%([0-9]+%) +")) bounds = s[3][1] delay = toint(argstr[bounds[1]..bounds[2]]) argstr = argstr[s[2] + 1..length(argstr)] else delay = 2 endif if (!$command_utils:yes_or_no(tostr("Do you really want to shut down the server in ", delay, " minutes?"))) player:notify("Aborted.") return endif announce_times = {} if (delay > 0) while (delay > 0) announce_times = {@announce_times, delay * 60} delay = delay / 2 endwhile announce_times = {@announce_times, 30, 10} $shutdown_time = time() + announce_times[1] endif $shutdown_message = tostr(player.name, " (", player, "): ", argstr) $shutdown_task = task_id() for i in [1..length(announce_times)] msg = tostr("*** The server will be shut down by ", player.name, " (", player, ") in ", $time_utils:english_time(announce_times[i]), ": ", argstr, " ***") "...use raw notify() since :notify() verb could be broken..." for p in (connected_players()) notify(p, msg) endfor suspend(announce_times[i] - {@announce_times, 0}[i + 1]) endfor for p in (connected_players()) notify(p, tostr("*** Server shutdown by ", player.name, " (", player, "): ", argstr, " ***")) boot_player(p) endfor suspend(0) $shutdown_task = E_NONE set_task_perms(player) shutdown(argstr) "Last modified by Dax (#789) on Tue May 3 14:09:29 2005 MDT." .