This command can be used and distributed freely. The original version of this was taken from Smaug 1.4a.
do_pcrename allows you to fully rename a pc. If we have missed something that should change with a rename,
please contact us at darkwarsmud@hotmail.com and let us know.


/*
 * Command to rename a player - Brought to SWR (and fixed) by Gavin
 * Snippetized with a few mods by Greven, most of the work by ^^^^^
 */
void do_pcrename( CHAR_DATA *ch, char *argument )
{
	CHAR_DATA *victim;
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char newname[255];
	char oldname[255];
	char backname[255];
	char buf[MAX_STRING_LENGTH];
    	NOTE_DATA *pnote;
	BOARD_DATA *tboard;
	
	argument = one_argument( argument, arg1 );
	one_argument( argument, arg2 );
//Can't have a ~ in the players name, lets make it a -
	smash_tilde( arg2 );
	
	
	if ( IS_NPC(ch) )
		return;
	
	if ( arg1[0] == '\0' || arg2[0] == '\0' )
	{
		send_to_char("Syntax: pcrename <victim> <new name>\n\r", ch );
		return;
	}
	
	if  (!check_parse_name( arg2 ) )
	{
		send_to_char("Illegal name.\n\r", ch );
		return;
	}
	
	/* Just a security precaution so you don't rename someone you don't mean 
	 * too --Shaddai
	 */
	if ( ( victim = get_char_room ( ch, arg1 ) ) == NULL )
	{
		send_to_char("That person is not in the room.\n\r", ch );
		return;
	}

	if ( IS_NPC(victim ) )
	{
		send_to_char("You can't rename NPC's.\n\r", ch );
		return;
	}
	
	if ( get_trust(ch) < get_trust(victim) )
	{
		send_to_char("I don't think they would like that!\n\r", ch );
		return;
	}
	
	snprintf( newname, 255, "%s%c/%s", PLAYER_DIR, tolower(arg2[0]),
			capitalize( arg2 ) );
	snprintf( oldname, 255, "%s%c/%s",PLAYER_DIR,tolower(victim->name[0]),
			capitalize( victim->name ) );
	snprintf( backname, 255, "%s%c/%s",BACKUP_DIR,tolower(victim->name[0]),
			capitalize( victim->name ) );

// Lets check there is no player by that name already	
	if ( access( newname, F_OK ) == 0 )
	{
		send_to_char("That name already exists.\n\r", ch );
		return;
	}
	
	/* Have to remove the old god entry in the directories */
	if ( IS_IMMORTAL( victim ) )
	{
		char godname[MAX_STRING_LENGTH];
		snprintf(godname, 255, "%s%s", GOD_DIR, capitalize(victim->name));
		remove( godname );	
	}
	
	/* Remember to change the names of the areas */
	if ( victim->pcdata->area )
	{
		char filename[255];
		char newfilename[255];
		
		snprintf( filename, 255, "%s%s.are", BUILD_DIR, victim->name);
		snprintf( newfilename, 255, "%s%s.are", BUILD_DIR, capitalize(arg2));
		rename(filename, newfilename);
		snprintf( filename, 255, "%s%s.are.bak", BUILD_DIR, victim->name);
		snprintf( newfilename, 255, "%s%s.are.bak", BUILD_DIR, capitalize(arg2));
		rename(filename, newfilename);
	}
	
	if ( remove( oldname ) )
	{
		snprintf(buf, MSL, "Error: Couldn't delete file %s in do_rename.", oldname);
		send_to_char("Couldn't delete the old file!\n\r", ch );
		log_string( oldname );
	}		

#ifdef FINGER
	/* Lets Do The Finger Files. This won't work unless your using the finger code */
	{
		snprintf( newname, 255, "%s%c/%s.F",PLAYER_DIR,tolower(victim->name[0]), capitalize( victim->name ) );
		remove( newname );
	}
#endif

	/* Lets fix any ships they own */
	{
		bool changed = false;
		SHIP_DATA * ship = NULL;
		for ( ship = first_ship; ship; ship = ship->next )
		{
			changed = false;
			if (!str_cmp(victim->name, ship->owner))
			{
				strcpy(ship->owner, arg2);
				changed = TRUE;
			}
			if (!str_cmp(victim->name, ship->pilot))
			{
				strcpy(ship->pilot, arg2);
				changed = TRUE;
			}
			if (!str_cmp(victim->name, ship->copilot))
			{
				strcpy(ship->copilot, arg2);
				changed = TRUE;
			}
			if ( changed )
				save_ship(ship);
		}
	}
	/* Lets do clans now */
	{
		if ( victim->pcdata->clan )
		{
			CLAN_DATA * clan = victim->pcdata->clan;
			if (!str_cmp(victim->name, clan->leader))
				strcpy(clan->leader, arg2);
			if (!str_cmp(victim->name, clan->number1))
				strcpy(clan->number2, arg2);
			if (!str_cmp(victim->name, clan->number2))
				strcpy(clan->number2, arg2);
			save_clan(clan);
		}
	}
	/* Lets do clones now */
	{
		snprintf( newname, 255, "%s%c/%s.clone",PLAYER_DIR,tolower(victim->name[0]), capitalize( victim->name ) );
		remove( newname );
	}

	/* Lets Do board stuff too */
	for ( tboard = first_board; tboard; tboard = tboard->next )
	{
		bool change = FALSE;
		for ( pnote = tboard->first_note; pnote; pnote = pnote->next )
		{
			if (!str_cmp(victim->name, pnote->sender))
			{
				STRFREE(pnote->sender);
				pnote->sender = STRALLOC( capitalize(arg2) );
				change = TRUE;
			}
			if (!str_cmp(victim->name, pnote->to_list))
			{
				STRFREE(pnote->to_list);
				pnote->to_list = STRALLOC( capitalize(arg2) );
				change = TRUE;
			}
			/* Update lists? */
		}
		if (change)
			write_board( tboard );
	}

	/* Lets do homes now */
	{
		snprintf( newname, 255, "%s%c/%s.home",PLAYER_DIR,tolower(victim->name[0]), capitalize( victim->name ) );
		remove( newname );
	}

	
	STRFREE( victim->name );
	victim->name = STRALLOC( capitalize(arg2) );    
	remove( backname );
	/* Time to save to force the affects to take place */
	save_char_obj( victim );
#ifdef FINGER
   	save_finger( victim );
#endif
	save_home(victim);
	/* Now lets update the wizlist */
	if ( IS_IMMORTAL( victim ) )
		make_wizlist();
	
	send_to_char("Character was renamed.\n\r", ch );
	return;
}

Put this command in act_wiz.c at the bottom. Add the entries to mud.h and tables.c. Make clean, make, reboot.
For the command itself, from within the mud, do:

cedit pcrename create
cedit save cmdtable

That should be it. Enjoy!