Alright, I've tried to install a locker code into my mud, and it has worked perfectly except for one thing. They cannont close the locker, and I know how unspecific that can be so I'll post the closing code here. Then if I must I will post additional code such as the fwrite_locker and such. It only crashes on closing the locker by the way.
From the do_locker function:
Trying to find where the error really is I added in send_to_char statements before delete_locker and fwrite_locker, assuming that they would show up before it crashed. Assuming that would work right, and it always has before, then those functions are clean because it crashes before either come up. Perhaps a problem with the for loop? I'm not sure, please help :)
From the do_locker function:
else if( !str_cmp( arg, "close" ) )
{
if( !ch->pcdata->locker )
{
send_to_char( "You are not currently in the locker room.\r\n", ch );
return;
}
locker = ch->pcdata->locker;
/* Total the weight of the contents */
locker->holding = 0;
for( obj = ch->in_room->first_content; obj; obj = obj->next_content )
{
locker->holding = locker->holding + obj->weight;
if( obj->item_type == ITEM_CONTAINER )
{
send_to_char( "You may not leave containers in the locker room.\r\n", ch );
return;
}
}
if( locker->holding > locker->capacity )
{
sprintf( buf, "The weight limit of your locker has beed exceeded. "
"You must carry\r\nsome items out when you leave.\r\n" );
send_to_char( buf, ch );
return;
}
/* Save the locker */
fwrite_locker( ch );
/* Return the player to the real world. */
char_from_room( ch );
char_to_room( ch, get_room_index( ch->pcdata->locker_vnum ) );
delete_locker( ch );
do_look( ch, "auto" );
send_to_char( "Your locker has been closed and saved.\r\n", ch );
}
else
{
send_to_char( "Syntax: locker <open | close>\r\n", ch );
return;
}
return;
}Trying to find where the error really is I added in send_to_char statements before delete_locker and fwrite_locker, assuming that they would show up before it crashed. Assuming that would work right, and it always has before, then those functions are clean because it crashes before either come up. Perhaps a problem with the for loop? I'm not sure, please help :)