help with a new command

Posted by Tidus on Tue 27 Apr 2004 04:04 PM — 1 posts, 8,823 views.

#0
I have put in a plist command which is a variation of a snippet I found not too long ago. It displays everyone in the player directory and it used to also display thier warpoints next to thier name but one day it started only displaying my own warpoints next to everyone else's name. I am not sure what is wrong with it. I have attached a copy of the function here, if anyone could please help me that would be great.

void do_plist( CHAR_DATA *ch, char *argument )
{
DIR *dp;
struct dirent *ep;
char buf[80];
char buffer[MAX_STRING_LENGTH*4];
bool is_playing = FALSE;
bool ploaded = FALSE;
CHAR_DATA *victim;


dp = opendir ("../player");


if (dp != NULL)
{

while ( (ep = readdir (dp)))
{
if ( ep->d_name[0] == '.' )
continue;

for(victim = char_list;victim != NULL;victim = victim->next)
{


{
if(IS_NPC(victim))
continue;
if(is_name(victim->name, ep->d_name))
break;


}



if ( victim == NULL )
{
victim = pload(ep->d_name);
ploaded = TRUE;
is_playing = FALSE;
}
else
{
is_playing = TRUE;
ploaded = FALSE;
}


sprintf( buf, "%-15s %4d\n\r",
ep->d_name, victim->warpoints);
strcat( buffer, buf );
}

if(ploaded)
punload(victim);
}

closedir (dp);
}

else
perror ("Couldn't open the directory");

page_to_char( buffer, ch );

return;
}