[CODE][NEWBIE][MIGRATION BETWEEN BUILDS]rename

From: anthony benjamin (benjamin@powerweb.net)
Date: 02/14/99


one more time...
I have this command now...and I am just wondering what else I need to
change to make it work with bpl14...I have already changed the part
about checking to see if the player is on..now I need help making the
actual change to the player files...

Incidently when I try using this code..I crash the mud.. ; ) Sorry for
the bother...
anthony

here is my current code:

ACMD(do_rename)
{
  int player_i;
  extern int top_of_p_table;
  extern struct player_index_element *player_table;
  struct char_file_u tmp_store;
  struct char_data *victim=NULL;
  char tmp_name[MAX_INPUT_LENGTH], arg1[MAX_INPUT_LENGTH],
    arg2[MAX_INPUT_LENGTH];
  extern struct char_data *is_playing(char *vict_name);
  extern save_char_file_u(struct char_file_u st);
  two_arguments(argument, arg1, arg2);

  if(!ch || IS_NPC(ch))
    return;

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

  if (!(victim = get_char_vis(ch, arg))){
    if(GET_LEVEL(ch) <= GET_LEVEL(victim)) {
      send_to_char("You don't have permission to change that name.",ch);

      return;
    }
    if ((player_i = load_char(tmp_name, &tmp_store)) > -1){
        send_to_char("There is already a player with that
name.\r\n",ch);
        return;
    }
    sprintf(buf2,"&1&bYou have renamed &7%s&1 to
&7%s&0\r\n",GET_NAME(victim),CAP(tmp_name));
    send_to_char(buf2, ch);
    strcpy((player_table + GET_PFILEPOS(victim))->name,CAP(tmp_name));
    strcpy(victim->player.name, CAP(tmp_name));
    save_char(victim, victim->in_room);
    Crash_crashsave(victim);
    sprintf(buf2,"&1&b!!! You have been renamed to
&7%s&1.&0\r\n",GET_NAME(victim));
    send_to_char(buf2, victim);
  }
  else {
    send_to_char("That player is not playing at the moment.\r\n",ch);
  }
}


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



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