Away Message v1.0

What this does:

	When you type AFK you will have a decision to type a short little message for when
people send you TELLS. When they send you a TELL they will be notified that you are AFK and
display to them your away message. This isn't really necassary for Star Wars but it helps
players and/or Immortals.

What you will need to change:

act_comm.c
act_info.c
mud.h

-------------------------------------------------------------------------------------------------

act_comm.c

Find,

char *  drunk_speech    args( ( const char *argument, CHAR_DATA *ch ) ); 

Below it add,

void afk_message_send( CHAR_DATA * ch, CHAR_DATA * sender )
{
    char * buf = ch -> afk_mes;
    if( buf == NULL || buf == "none" )
    {
        send_to_char( "&RThere was no message.\n\r" , sender );
        return;
    }
    send_to_char( "&YThey left a message&O:&W \n", sender );
    send_to_char( ch -> afk_mes, sender );
    send_to_char( "\n\r", sender );
    return;
}

void afk_message_set( CHAR_DATA * ch, char * message )
{
    if(message[0] == '\0')message="none";
    sprintf( ch -> afk_mes, "%s", message );
    if(message=="none")
    send_to_char( "Your message has been cleared.\n\r", ch );
     else
    send_to_char( ch -> afk_mes, ch );
    send_to_char( "\nYour afk message has been set.\n\r", ch );
    return;
}

Find,

void do_tell( CHAR_DATA *ch, char *argument )

In that function find this,

    if ( !IS_NPC (victim) && ( IS_SET (victim->act, PLR_AFK ) ) )
    {
      send_to_char( "&RThat player is afk.\n\r", ch );
      return;
    }

Change it to look like this,

    if ( !IS_NPC (victim) && ( IS_SET (victim->act, PLR_AFK ) ) )
    {
      send_to_char( "&RThat player is afk.\n\r", ch );
      afk_message_send( victim, ch );
      return;
    }

Find,

void do_reply( CHAR_DATA *ch, char *argument )

In that function find this,

    if ( !IS_NPC (victim) && ( IS_SET (victim->act, PLR_AFK ) ) )
    {
      send_to_char( "&RThat player is afk.\n\r", ch );
      return;
    }

Change it to look like this,

    if ( !IS_NPC (victim) && ( IS_SET (victim->act, PLR_AFK ) ) )
    {
      send_to_char( "&RThat player is afk.\n\r", ch );
      afk_message_send( victim, ch );
      return;
    }

-------------------------------------------------------------------------------------------------

act_info.c

Find,

void do_afk( CHAR_DATA *ch, char *argument )

Change that whole command to look like this,

void afk_message_set( CHAR_DATA * ch, char * message );
void do_afk( CHAR_DATA *ch, char *argument )
{
     if ( IS_NPC(ch) )
     return;
     
     if IS_SET(ch->act, PLR_AFK)
     {
    	REMOVE_BIT(ch->act, PLR_AFK);
	send_to_char( "Your message was: ", ch);
	send_to_char( ch->afk_mes, ch );
	send_to_char( "\n", ch );
	send_to_char( "You are no longer afk.\n\r", ch );
	act(AT_GREY,"$n is no longer afk.", ch, NULL, NULL, TO_ROOM);
     }
     else
     {
	afk_message_set( ch, argument );
	SET_BIT(ch->act, PLR_AFK);
	send_to_char( "You are now afk.\n\r", ch );
	act(AT_GREY,"$n is now afk.", ch, NULL, NULL, TO_ROOM);
	return;
     }
         
}

-------------------------------------------------------------------------------------------------

mud.h

Find,

struct	char_data

Add this somewhere in there,

    char 		afk_mes[MAX_STRING_LENGTH];

Find,

DECLARE_DO_FUN( do_setplanet    );

Add this above it,

DECLARE_DO_FUN( afk_message_set );

-------------------------------------------------------------------------------------------------

make clean
make
copyover/reboot your mud

From now on your afk command should work fine, and sending tells/replies will display the
victims afk message.

-,,,.,,,,-
_'Diablo'_ Star Wars Development
  ''''''

[*]------------------------------------------------[*]
||| If you have any problems please contact me at: |||
|||           crazy_mike_316@hotmail.com           |||
[*]------------------------------------------------[*]