Name Change Snippet [by Paolo Greco]
Snippet Posted Friday, December 1st @ 05:21:47 PM, by Brandon Brown in the Players dept.
Paolo "Razor" Greco supplies a snippet allowing for admins to change the names of players.
Usage: Namechange  
Will cermanently change the name of a given PC and saving him afterward.
This is based on a snipped posted on circlemud mailing list by Someone I Don'T Remember.
Written in italian language for CM3.0bpl14 whith xapobj, dgscripts, some weird class & race system, but doesn't matter.
If world go bleak for this snippet, that's YOUR fault.
Hi people, a dinamic 2000000000 room wilderness snippet will follow.

ACMD(do_namechange){
  struct char_data *vict;  char *oldname;
  int i,j;
  char arg1[MAX_STRING_LENGTH];
  char arg2[MAX_STRING_LENGTH];
  char tmp_name[MAX_STRING_LENGTH];

  half_chop(argument, arg1, argument);
  half_chop(argument, arg2, argument);
 
  if ((!*arg1) || (!*arg2)) {
    send_to_char("Usage: namechange  \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;
  }
 
  if (find_name(arg2)>-1)  {
    send_to_char("There's already somebody with this name.\r\n",ch);
    return;
  }
 

  if ((_parse_name(arg2, tmp_name))||strlen(tmp_name) < 2 ||
   strlen(tmp_name) > MAX_NAME_LENGTH || !Valid_Name(tmp_name) ||
   fill_word(tmp_name) || reserved_word(tmp_name)) {
 send_to_char("Illegal name, retry.\r\n", ch);
 return;
  }
 
  for (i = 0; i <= top_of_p_table; i++)
    if (player_table[i].id == GET_IDNUM(vict))
      break;
  
  if (player_table[i].id != GET_IDNUM(vict)){
    send_to_char("BUG: error in player table!!!!",ch);
    log("BUG: error in player table for %s with idnum %d",
      GET_NAME(ch),GET_IDNUM(ch));
    return;
  }
  
  oldname = strdup(GET_NAME(vict));
 
  //player_table[i].name = strdup(arg2);
  for (j = 0; (*(player_table[i].name + j) = LOWER(*(arg2 + j))); j++);
  
  strcpy(vict->player.name, CAP(arg2));  
 
  sprintf(buf, "(GC) %s has changed the name of %s to %s.", GET_NAME(ch),GET_NAME(vict), arg2);
  mudlog(buf, BRF, LVL_IMMORT, TRUE);
 
  save_char(vict, vict->in_room);
 
  send_to_char("Ok.\r\n",ch);
  send_to_char("Your name has changed.\r\n",vict);
}
 

<< Improved do_look and scan [by Ross Arnold] | Reply | Flattened >>

 


Related Links
  CircleMUD
Paolo "Razor" Greco
Related Articles
More by bbrown
 
 

Quick Links
 
The CircleMUD FAQ
The CircleMUD home page
Alex's Snippets
Wintermute Snippets
CircleMUD Bug Reporting or Help
CircleMUD List Archives
CircleMUD Resources
Death Gate's Scripts
(Author of C conversion)
Sammy's code site
Erwin S. Andreasen's page
(Author of mudFTP and other goodies)
Death's Gate Scripting site
Help for CircleMUD in Windows
The OasisOLC Maintenance Effort
George's Random Stuff
Imaginary Realities
MUD Dictionary