This is the first snippet I've done that is worth submitting here, so here goes. This snippet
is for Muds THAT HAVE A PRAY CHANNEL. It simply logs all the things people pray to a file. It
comes with a command to delete that file online as well as read the file (it can get big, so
consider yourself warned.) Anyways, it's not the most useful but its something and I take a
tiny bit of pride in it, so ha!

Oh, uhm, I don't really care if you give me credit or not, I hate giving people credit so do
what you wish :)

--> Add this to act_wiz.c or whatever you like.

void do_prayfile(CHAR_DATA *ch, char *argument)
{
    char arg[MAX_STRING_LENGTH];
    FILE *fp;
    char buf[MSL];
    int x;

    argument = one_argument( argument, arg );


    if ( arg[0] == '\0')
    {
        send_to_char( "Syntax: prayfile <delete/read>\n\r", ch );
        return;
    }


    if (!str_prefix(arg,"delete"))
    {
        fclose(fopen("pray.txt","w"));
        send_to_char("Pray logfile has been cleaned.\n\r", ch);
        return;
    }
    else if (!str_prefix(arg,"read"))
    {
        if ( (fp = fopen("pray.txt","r")) != NULL )
        {
                while (!feof(fp))
                {
                        if ((x = fread(&buf, 1, MSL, fp)) == 0) break;
                        buf[x] = 0;
                        send_to_char(buf, ch);
                }
                fclose(fp);
        }
    return;
    }
    else
    {
        send_to_char( "Syntax: prayfile <delete/read>\n\r", ch );
        return;
    }

    return;
}

--> In your do_pray command, add:

append_pray (ch, PRAY_FILE, argument);

--> In merc.h, add this line under the definitions for MUSIC_FILE, BAN_FILE, etc

#define PRAY_FILE       "pray.txt"


--> Add this to merc.h with the local funcions of db, (right by the one for append_file:

void     append_pray         args( ( CHAR_DATA *ch, char *file, char *str ) );

--> Add this to db.c before or after append_file

void append_pray (CHAR_DATA * ch, char *file, char *str)
{
    FILE *fp;

    if (IS_NPC (ch) || str[0] == '\0')
        return;

    fclose (fpReserve);
    if ((fp = fopen (file, "a")) == NULL)
    {
        perror (file);
        send_to_char ("Could not open the file!\n\r", ch);
    }
    else
    {

        fprintf (fp, "%s prays: %s, on %s",
                ch->name, str, (char *) ctime (&current_time));
        fclose (fp);

    }


    fpReserve = fopen (NULL_FILE, "r");
    return;
}

--> Create pray.txt in your area directory.

--> Add the prayfile command to interp.c and interp.h

Sidenotes: You might want to add a check in do_prayfile so lower level imms can use it, but
only the 'read' arg. On my MUD, its for IMPS only.