/* This function is fairly CPU intensive, if anyone finds a better way to do this, please send me an email Virus139@yahoo.com any questions you can email me there as well.. This command was written and tested on ROM2.4b6 snippet originated from Thus far i've not found and bugs with this function.. so lemme know if you encounter any problems.. add the following includes to the top of the file you wish to add plist to. */ #include <dirent.h> #include <unistd.h> #include <sys/types.h> #include <sys/time.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <sys/stat.h> #include <sys/resource.h> #include <time.h> #include "merc.h" #include "recycle.h" #include "tables.h" #include "lookup.h" #include "interp.h" void do_plist(CHAR_DATA *ch, char *argument) { DESCRIPTOR_DATA *d; BUFFER *pbuf; struct dirent *Dir; DIR *Directory; char FName[80]; char buf[MSL]; int nMatch, neat1; char neat[MSL]; char neat2[MSL]; char neat3[MSL]; nMatch = 0; pbuf = new_buf(); d = new_descriptor(); Directory = opendir( PLAYER_DIR ); Dir = readdir( Directory ); send_to_char("{C PLAYER BASE {x\n\r",ch); send_to_char("{RName lvl Race Class {x\n\r",ch); send_to_char("{R==============================================={x\n\r",ch); while( Dir != NULL ) { sprintf(FName, PLAYER_DIR "%s", Dir->d_name); { if (Dir->d_name[0] >= 'A' && Dir->d_name[0] <= 'Z') { nMatch++; load_char_obj( d, Dir->d_name ); if ( d->character->level <= ML ) { sprintf(neat, "%s", Dir->d_name); neat1 = d->character->level; sprintf(neat2,"%s", capitalize(race_table[d->character->race].name)); sprintf(neat3,"%s", capitalize(class_table[d->character->class].name)); sprintf(buf, "{B[{c%-12s{B][{c%-2d {B][{c%-10s {B][{c%-12s {B]{x\n\r", neat, neat1, neat2, neat3); add_buf(pbuf, buf); } } } Dir = readdir( Directory ); } closedir( Directory ); page_to_char(buf_string(pbuf), ch); free_buf(pbuf); sprintf( buf, "\n\r{cPlayers found{C: {Y%d{x\n\r", nMatch ); send_to_char( buf, ch ); return; } /* in interp.c: {"plist", do_plist, POS_DEAD, ML, LOG_ALWAYS, 1}, in interp.h: DECLARE_DO_FUN( do_plist ); That should just about do it.. */