Name Changing

From: StormeRider (silk@ICI.NET)
Date: 01/01/98


Well, got the primary bugs ironed out of the namechange function but
there's one minor problem. It changes it fine and saves the pfile, but
doesn't update the plr_index. I have tried calls to build_player_index and
save_player_index and neither of them work. Copied over and still can't log
in as the changed name.

Code below:
ACMD(do_namechange)
{
  struct char_data *vict;
  char *oldname;
  char arg1[MAX_STRING_LENGTH];
  char arg2[MAX_STRING_LENGTH];

  half_chop(argument, arg1, argument);
  half_chop(argument, arg2, argument);

  if ((!*arg1) || (!*arg2)) {
    send_to_char("Usage: namechange <character> <new name>\r\n", ch);
    return;
  }

  if (!(vict = get_player_vis(ch, arg1, 0))) {
    send_to_char("They aren't here.\r\n", ch);
    return;
  }

  if (GET_LEVEL(vict) > 5) {
    send_to_char("You can't change the name of someone over level 5.\r\n",
ch);
    return;
  }

  sprintf(buf, "(GC) %s changed %s's name to %s.", IMM_NAME(ch),
GET_NAME(vict), arg2);
  mudlog(buf, BRF, LVL_IMMORT, TRUE);

  oldname = strdup(GET_NAME(vict));

  GET_NAME(vict) = strdup(arg2);
  save_player_index();
  build_player_index();
  save_char(vict, vict->in_room);
  send_to_charf(ch, "%s is now known as %s.\r\n", oldname, GET_NAME(vict));
  send_to_charf(vict, "%s has changed your name!\r\n", IMM_NAME(ch));
  send_to_roomf(vict->in_room, "%s is now known as %s.\r\n", oldname,
GET_NAME(vict));
}


StormeRider                  --- http://www.windsofstorm.net/wos/
silk@ici.net                 --- telnet://cmoo.com:4004


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST