/*merc.h puts these */ extern bool isreboot; extern int pulse_muddeath; extern CHAR_DATA * mudkiller; /* at the top of act_wiz.c put these */ isreboot = TRUE; pulse_muddeath = -1; mudkiller = NULL; /* define these at the top of act_wiz.c */ void reboot_shutdown args( (CHAR_DATA *mudkiller, bool isreboot) ); void check_muddeath args( ( void ) ); /* define these at the top of update.c */ void reboot_shutdown args( (CHAR_DATA *mudkiller,bool isreboot) ); /*find the folling and add the following update.c */ if ( --pulse_point <= 0 ) { wiznet("TICK!",NULL,NULL,WIZ_TICKS,0,0); pulse_point = PULSE_TICK; weather_update ( ); char_update ( ); obj_update ( ); check_muddeath ( ); /* add this line */ } /* add this function to update.c */ void check_muddeath(void) { char buf[MAX_STRING_LENGTH]; buf[0] = '\0'; if (pulse_muddeath < 0) return; if (pulse_muddeath == 0) reboot_shutdown(mudkiller,isreboot); if (pulse_muddeath > 0) { sprintf(buf,"%s in %d minute(s)\n\r", isreboot ? "Reboot" : "Shutdown", pulse_muddeath); do_echo(mudkiller,buf); } --pulse_muddeath; return; } /* replace your do_reboot and do_shutdown functions with these */ void do_reboo( CHAR_DATA *ch, char *argument ) { send_to_char( "If you want to REBOOT, spell it out.\n\r", ch ); return; } void do_reboot( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; one_argument(argument, arg1); if (arg1[0] == '\0') { send_to_char("Syntax: Reboot Now\n\r" " Reboot Stop\n\r" " Reboot #\n\r", ch); return; } if (!str_cmp (arg1, "now")) { reboot_shutdown(ch,FALSE); return; } if (!str_cmp (arg1, "stop")) { if (pulse_muddeath >= 0 && isreboot) { pulse_muddeath = -1; isreboot = TRUE; mudkiller = NULL; do_echo(ch,"Reboot has been stopped, resume normal activities.\n\r"); return; }else { send_to_char("There is no reboot countdown in progress.\n\r",ch); return; } } if (is_number(arg1)) { if (atoi(arg1) < 1 || atoi(arg1) > 10) { send_to_char("Time range is between 1 and 10 minutes.\n\r", ch); return; } else { pulse_muddeath = atoi(arg1); isreboot = TRUE; mudkiller = ch; check_muddeath( ); return; } } else { send_to_char("Syntax: Reboot Now\n\r" " Reboot Stop\n\r" " Reboot #\n\r", ch); return; } return; } void do_shutdow( CHAR_DATA *ch, char *argument ) { send_to_char( "If you want to SHUTDOWN, spell it out.\n\r", ch ); return; } void do_shutdown( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; one_argument(argument, arg1); if (arg1[0] == '\0') { send_to_char("Syntax: Shutdown Now\n\r" " Shutdown Stop\n\r" " Shutdown #\n\r", ch); return; } if (!str_cmp (arg1, "now")) { reboot_shutdown(ch,TRUE); return; } if (!str_cmp (arg1, "stop")) { if (pulse_muddeath >= 0 && !isreboot) { pulse_muddeath = -1; isreboot = TRUE; mudkiller = NULL; do_echo(ch,"Shutdown has been stopped, resume normal activities.\n\r"); return; }else { send_to_char("There is no shutdown countdown in progress.\n\r",ch); return; } } if (is_number(arg1)) { if (atoi(arg1) < 1 || atoi(arg1) > 10) { send_to_char("Time range is between 1 and 10 minutes.\n\r", ch); return; } else { pulse_muddeath = atoi(arg1); isreboot = FALSE; mudkiller = ch; check_muddeath( ); return; } } else { send_to_char("Syntax: Shutdown Now\n\r" " Shutdown Stop\n\r" " Shutdown #\n\r", ch); return; } return; } /* one main function called multiple times :) */ void reboot_shutdown(CHAR_DATA *ch, bool reboot) { char buf[MAX_STRING_LENGTH]; extern bool merc_down; DESCRIPTOR_DATA *d,*d_next; sprintf( buf, "%s by %s.", reboot ? "Reboot" : "Shutdown", ch->name ); log_string(buf); if (!reboot) { append_file( ch, SHUTDOWN_FILE, buf ); strcat( buf, "\n\r" ); } do_echo( ch, buf ); merc_down = TRUE; for ( d = descriptor_list; d != NULL; d = d_next) { d_next = d->next; if (d->connected == CON_PLAYING) save_char_obj(d->original ? d->original : d->character); close_socket(d); } return; } /* do a full compile, make and pray :).... */