If I deny a name, they change it, then both characters now exist. For example, Bob renames to Bobby, both Bob and Bobby remain, so they have duplicate equipment now, etc. This is pretty bad. How would I fix this?
oldname = ch->name;
sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower(argument[0]),
capitalize( argument ) );
if ( stat( fname, &fst ) != -1 )
{
send_to_char("That name is already taken. Please choose another.\n\r", ch);
return;
}
STRFREE( ch->name );
ch->name = STRALLOC( argument );
STRFREE( ch->pcdata->filename );
ch->pcdata->filename = STRALLOC( argument );
send_to_char("Your name has been changed.\n\r", ch);
ch->pcdata->auth_state = 0;
sprintf( buf, "%s changed name to %s.", oldname, ch->name);
to_channel( buf, CHANNEL_AUTH, "Auth", LEVEL_NEOPHYTE );
return;
}