> I'm trying to write a code so if a certain flag, PLR_WATCHED for
> example, is affecting a player then everything that player types and
> sees is recorded in a file. Basically snoop into a file. I added the
> flag and the following in process_output in comm.c:
in interpreter.c, command_interpreter.. add this before everything..
if (PLR_FLAGGED(ch, PLR_WATCHED))
log_cmds(ch, argument);
and add in the log_cmds func looking like so:
void log_cmds(struct char_data *ch, char *argument)
{
FILE *fl;
char *tmp;
struct stat fbuf;
time_t ct;
sprintf(buf, "%s/%s.cmd", CMD_PRE, GET_NAME(ch));
ct = time(0);
tmp = asctime(localtime(&ct));
skip_spaces(&argument);
delete_doubledollar(argument);
if (!(fl = fopen(buf, "a"))) {
perror("log_cmd");
return;
}
*(tmp + strlen(tmp) - 1) = '\0';
fprintf(fl, "%-19.19s :: %s\n", tmp + 4, argument);
fclose(fl);
}
of course you have to define CMD_PRE as the directory (related to lib, i
believe) that you want command files to go into..
siv
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST