Re: [Code][Newbie] Set Name.. yeah yeah.

From: Emil Nilimaa (kyos_overlord@hotmail.com)
Date: 10/28/99


Ok,   (using cirlcle 3.0, ASCII pfiles)

this is my code for changing the name online on a player:
---------------------------------------------------------
case 56:

SET_BIT(PLR_FLAGS(vict), PLR_DELETED);
save_char(vict, NOWHERE);

free(vict->player.name);
vict->player.name = NULL;

vict->player.name = val_arg;
vict->player.name = str_dup(val_arg);
strcpy(vict->player.name, CAP(val_arg));


GET_PFILEPOS(vict) = create_entry(GET_PC_NAME(vict));


send_to_char("Your name has been changed.\r\n", vict);
send_to_char("Name Changed.\r\n", ch);
save_char(vict, NOWHERE);
build_player_index();

break;
---------------------------------------------------------

Now, i can change the name on the player... and it writes
his new name to the player_index.
however his id num get fucked up and instead of using his old id, he get
something linke 273636728  hehe.

Now when he quits and try to log back on, both his new name and the old name
are gone from the player_index.
(since i set the delete flag on the player)
Now this removes both of the names...

Anyone can tell me how i should go ahead to get the id num to stay the same,
and to set only the old name to be removed (delete flag) so he cant log back
in as old name. And still not delete flag the new name.

It could also be so that the player gets a new idum, like when a player gets
created.

GET_PFILEPOS(vict) = create_entry(GET_PC_NAME(vict));

This makes a new entry in the player_index?
However, when using this, the id num gets wrong, it does not get the last
idnum in player_table +1.. shrug

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


     +------------------------------------------------------------+
     | 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