[NEWBIE] [ASCII PFILE] [LONG] - Problem reading player files [PART I]

From: Khayman (khayman_br@geocities.com)
Date: 04/19/00


Before: My english isn't very well, so sorry about some errors. :)

    My problem is when I'm trying to read a file. When I use the command
STAT FILE ... I can read the file, but I have made a function to see all
players online and offline and return to me an information. Before the ascii
pfile I have used the CLAN DESTROY function to make my function, after I
have saw the STAT FILE ... function and I made my function using the same
way, but my function doesn't work.
    Sometimes the MUD can't read the files (maybe problem with lowercase and
uppercase) and sometimes (when it can read the file) crash.
    All the new functions in the code works very well (like
GET_DIVINDADE(ch)), because I use them in another codes.

The function run all players and return all players (on and off) that
believe in a choosen god.

My function before the ascii pfile (workin very well):

ACMD(do_seguidor)
{

  char buft1[1000];
  char buft2[1000];
  extern struct player_index_element *player_table;
  int j, seg;
  struct char_data *victim=NULL;
  struct char_file_u chdata;

  if (!*argument) {
     send_to_char("\r\nUse: SEGUIDOR <numero>\r\n\r\nEscolha uma das
seguintes divindades: \r\n\r\n1 - Khayman, o Ser Supremo da Justica\r\n2 -
Rash, o Ser Supremo da Morte e Destruicao\r\n3 - Sage, o Ser Supremo da
Sabedoria\r\n", ch);
     return;
  }

  one_argument(argument, arg);
  seg = atoi(arg);

  if (seg < 1 || seg > 3){
     send_to_char("\r\nUse: SEGUIDOR <numero>\r\n\r\nEscolha uma das
seguintes divindades: \r\n\r\n1 - Khayman, o Ser Supremo da Justica\r\n2 -
Rash, o Ser Supremo da Morte e Destruicao\r\n3 - Sage, o Ser Supremo da
Sabedoria\r\n", ch);
     return;
  }

  *buft1 = '\0';
  *buft2 = '\0';

  send_to_char("\r\nLista de seguidores de:\r\n",ch);
  sprintf(buft1, "%s", divindades[seg-1]);
  send_to_char(buft1, ch);

send_to_char("\r\n-----------------------------------------------------\r\n"
,ch);
  send_to_char("Online\r\n",ch);

send_to_char("-----------------------------------------------------\r\n",ch)
;

  *buft1 = '\0';

  for (j = 0; j <= top_of_p_table; j++){
     if((victim=is_playing((player_table +j)->name))) {
       if(GET_DIVINDADE(victim) == seg)

    sprintf(buft1 + strlen(buft1), "[%3d] %-20s - Atos: %1d\r\n",
GET_LEVEL(victim), GET_NAME(victim), GET_NIVEL_DIV(victim));
          } }
     else

       load_char((player_table + j)->name, &chdata);
       if(chdata.player_specials_saved.divindade == seg)
          sprintf(buft2 + strlen(buft2), "[%3d] %-20s - Atos: %1d\r\n",
chdata.level, (player_table + j)->name,
chdata.player_specials_saved.nivel_div);
     }
  }

  send_to_char(buft1, ch);
  send_to_char("\r\n\r\nOffline\r\n",ch);

send_to_char("-----------------------------------------------------\r\n",ch)
;
  send_to_char(buft2, ch);

send_to_char("-----------------------------------------------------\r\n",ch)
;

  return;

}


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT