/*
U B Glass ver 1.0 Nukeing System.

Instructions:
1. copy this command to your ACT_WIZ.C file
2. add the command to interp.c and interp.h
3. compile and enjoy.

Bugs:
none that I have found.

Note:
I am currently useing this code, however I have not tested it on any
code bases other than ROM.

Description:
This is an immortals force delete command it uses unlink to 
get rid of the pfiles. I have it set up so only the owner of the
MUD may nuke immortal characters. Depending on the level of the command though
if an immortal has the command can nuke any playing character who
isn't immortal.

Use:
Use of this code is granted as long as
this header:
// Nuke written by Virus for ROM.
is retained just above the function.
Thanks.

Written by Virus of the Madhouse.
themadhouse.org 1069
Email me at Virus139@hotmail.com if you run across any problems or if
you'd like to comment or just simply to let me know you are using
this code bit.

-Virus
*/

DECLARE_DO_FUN( do_echo		);

// Nuke written by Virus for ROM.
void do_nuke(CHAR_DATA *ch, char *argument)
{
   CHAR_DATA *victim;
   DESCRIPTOR_DATA *d;
   char buf[MSL];
   char arg1 [MAX_INPUT_LENGTH];
   char   strsave[MAX_STRING_LENGTH];

   argument = one_argument( argument, arg1 );
   victim = get_char_world(ch, arg1);

   if ( arg1[0] == '\0' )
   {
        send_to_char("Syntax: nuke <player name>\n\r",ch);
        return;
   }
   if (victim == NULL)
   {
      send_to_char("They must be playing.\n\r", ch);
      return;
   }
   if (IS_NPC(victim))
   {
      send_to_char("Not on NPC's\n\r", ch);
      return;
   }
   if (IS_IMMORTAL(victim))/* nukeing immortals is the job of the MUDs owner */
   {
   if ( !str_cmp(ch->name, "Virus"))/* change the name here from Virus to whom ever the owner of the MUD is. */
   {
     send_to_char("Authorization granted.{/", ch);
     sprintf(buf, "Thank you %s, for using the {GU B Glass{x ver 1.0 nukeing system.{/", ch->name);
     send_to_char( buf, ch );
     send_to_char("{YYour character has been deleted.{x\n\r", victim);
     sprintf( strsave, "%s%s", PLAYER_DIR, capitalize(victim->name ) );
     unlink(strsave);
     sprintf(buf, "{R%s has been fired by %s{x.", victim->name, ch->name);
     do_echo(ch, buf);   
     sprintf( strsave, "%s%s", GOD_DIR, capitalize(victim->name) );
     unlink(strsave);
     sprintf(buf, "[*****] NUKE: %s has been fired.", victim->name);
     log_string(buf);
     d = victim->desc;
     extract_char( victim, TRUE );
     if ( d != NULL )
     close_socket( d );
     return;
   }
   else
   {
        send_to_char("Only Virus has the Authorization to Nuke Immortal characters.",ch);
        sprintf(buf, "%s just attempted to NUKE you, but thats ok cuz %s doesn't have that authority.", ch->name,
        ch->sex == SEX_MALE ? "he" : ch->sex == SEX_FEMALE ? "she" : "it");
        send_to_char(buf, victim);
        return;
   }
   }
   if (!IS_NPC(victim))/* if an immortal has the command the CAN nuke playing characters */
   {
      sprintf(buf, "Thank you %s, for using the {GU B Glass{x ver 1.0 nukeing system.{/", ch->name);
      send_to_char( buf, ch );
      send_to_char("{YYour character has been deleted.{x\n\r", victim);
      sprintf( strsave, "%s%s", PLAYER_DIR, capitalize(victim->name ) );
      unlink(strsave);
      sprintf(buf, "%s pulls out a {rBIG RED{x NUKE button, and NUKES %s.", ch->name, victim->name);
      do_echo(ch, buf); 
      sprintf(buf, "[*****] NUKE: %s has been nuked by %s", victim->name, ch->name);
      log_string(buf);
      d = victim->desc;
      extract_char( victim, TRUE );
      if ( d != NULL )
      close_socket( d );
      return;
   }
}