I can't help you with making the change to the player file, but I
can make some suggestions as to what you have wrong here.
Sean
On Sun, 14 Feb 1999, anthony benjamin wrote:
> 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))){
^^^
What is arg? You most likely want arg1 here.
To behonest, I'm not surprised this crashes. I am surprised it
compiled cleanly. You didn't get any warnings?
> 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){
Let's look at the previous line of code.
if ((player_i = load_char(tmp_name, &tmp_store)) > -1){
Now load_char will load the pfile information for the character
tmp_name (if it exists). Unfortunately for you, you've never actually
setup tmp_name anywhere. I assume you want to utilize arg2 somewhere in
here.
> 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
+------------------------------------------------------------+
| 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