Ok, had a look around, and tried a couple of things. A little progress made.
The first time a player dies, it now moves their pfile onto a backup file. However, now it simply means that the problem occurs after they've died twice, as it doesn't ever delete the backup files. How do I make these delete themselves if a player by the same name dies?
Also, I tried adding a command to the end of the do_quit command to make it disconnect the server, and it crashed the mud. Can anyone give me an idea of what I should be writing. This is a copy of my do_quit
void do_qui( CHAR_DATA *ch, char *argument )
{
set_char_color( AT_RED, ch );
send_to_char( "If you want to QUIT, you have to spell it out.\n\r", ch );
return;
}
void do_quit( CHAR_DATA *ch, char *argument )
{
/* OBJ_DATA *obj; */ /* Unused */
int x, y;
int level;
if ( IS_NPC(ch) && IS_SET(ch->act, ACT_POLYMORPHED))
{
send_to_char("You can't quit while polymorphed.\n\r", ch);
return;
}
if ( IS_NPC(ch) )
return;
if ( ch->position == POS_FIGHTING )
{
set_char_color( AT_RED, ch );
send_to_char( "No way! You are fighting.\n\r", ch );
return;
}
if ( ch->position < POS_STUNNED )
{
set_char_color( AT_BLOOD, ch );
send_to_char( "You're not DEAD yet.\n\r", ch );
return;
}
if ( auction->item != NULL && ((ch == auction->buyer) || (ch == auction->seller) ) )
{
send_to_char("Wait until you have bought/sold the item on auction.\n\r", ch);
return;
}
if ( !IS_IMMORTAL(ch) && ch->in_room && !IS_SET( ch->in_room->room_flags , ROOM_HOTEL ) && !NOT_AUTHED(ch) )
{
send_to_char("You may not quit here.\n\r", ch);
send_to_char("You will have to find a safer resting place such as a hotel...\n\r", ch);
send_to_char("Maybe you could HAIL a speeder.\n\r", ch);
return;
}
set_char_color( AT_WHITE, ch );
send_to_char( "Your surroundings begin to fade as a mystical swirling vortex of colors\n\renvelops your body... When you come to, things are not as they were.\n\r\n\r", ch );
act( AT_SAY, "A strange voice says, 'We await your return, $n...'", ch, NULL, NULL, TO_CHAR );
act( AT_BYE, "$n has left the game.", ch, NULL, NULL, TO_ROOM );
set_char_color( AT_GREY, ch);
sprintf( log_buf, "%s has quit.", ch->name );
quitting_char = ch;
save_char_obj( ch );
save_home(ch);
saving_char = NULL;
level = get_trust(ch);
/*
* After extract_char the ch is no longer valid!
*/
extract_char( ch, TRUE );
for ( x = 0; x < MAX_WEAR; x++ )
for ( y = 0; y < MAX_LAYERS; y++ )
save_equipment[x][y] = NULL;
/* don't show who's logging off to leaving player */
/*
to_channel( log_buf, CHANNEL_MONITOR, "Monitor", level );
*/
log_string_plus( log_buf, LOG_COMM, level );
return;
}
|