char_leaving

Posted by Klered on Thu 15 Sep 2005 03:52 PM — 3 posts, 16,049 views.

#0
Hi.

When a player dumps out of the game, ie, do_quit, we have ->

char_leaving( ch, 4 );

but what I would like to do is dump the player back into a con_state somewhere in the nanny, specifically a new con_state to pick another player.

This bit below instead of using
char_leaving 
dumps them back into the nanny - but upon re-entering the game through our game menu results in a 'End of the World' message and Short-cutting not allowed =)


for(d = first_descriptor; d; d = d->next) 
    DESCRIPTOR_DATA *d; 
    /*24 = game menu*/
    ch->desc->connected = 24;
    d->connected = 24;




Can someone give me an overview of what I am looking at here as far as time to a)get a player back to constate 24, and be able to rejoin the game as is ... and...b)work out an account system?

Thanks,

Kl
Amended on Thu 15 Sep 2005 04:58 PM by Klered
Canada #1
Why are you looping through all of the descriptors and making everyone back to that con state? You would probably want to look at extract_char in handler.c, around this line:
        if (ch->desc)
        {
                if (ch->desc->character != ch)
                        bug("Extract_char: char's descriptor points to another char", 0);
                else
                {
                        ch->desc->character = NULL;
                        close_socket(ch->desc, FALSE);
                        ch->desc = NULL;
                }
        }

The character will be completely dealt with(sort of, still hase to be freed, but thats handled else where), etc, but you still have their descriptor. You could just set the descriptor back to 24 and that SHOULD work, though completely untested.

As for an account system, I beleive that there are a couple snippets somewhere out there, but I highly recommend writing your own. I did this, and it is much better (IMHO) for what I need than the snippets.
#2
Thanks Greven I will take a look.

PS - You have mail.

KL