Adding a message of the day

This is for people who can compile the SiN source code

How to add a Message of the Day file to SiN
*******************************************

All modifications are to g_main.cpp to add the MOTD.

1) Put this near the top (don't copy the lines of "=====")

============================
//RiEvEr
void ShowMOTD( edict_t *ent );
//R
============================

2) Then find this bit in the G_ClientBegin function and add the //RiEvEr->//R part

=====================================

else
{
// send effect if in a multiplayer game if ( game.maxclients > 1 ) { gi.bprintf (PRINT_HIGH, "%s entered the game\n", ent->client->pers.netname); //RiEvEr ShowMOTD( ent ); //R } }
=====================================

3) Then add this function to the bottom of the file:

=====================================

 void    ShowMOTD( edict_t *ent )



 {

	 str     filename;

	 FILE    *motdfile;

	 char    message[512]; // half a kb should be enough

	 str     message2;

	 char    line[80];



	 if( str( ent->entity->getClassID()) == str("bot"))

			 return;



	 filename = gi.GameDir();

	 filename += "/motd.ini";



	 if (motdfile = fopen(filename.c_str(), "r"))

	 {

		 if ( fgets(message, 512, motdfile) )

		 {

			 while ( fgets(line, 80, motdfile) )

			 {

					 strcat( message, line);

			 }



		 }

		 fclose(motdfile);

		 message2 = str(message);

	 }

	 else

	 {

		message2 = "Welcome to SiN\n";

	 }

	 gi.centerprintf( ent, "jcx jcy string \"%s\"", message2.c_str() );

 }
====================================

4) Now type up an "motd.ini" file with a message in it and away you go.

RiEvEr..

You can download the compiled DLL