Re: help w/a command similar to transfer

Jeremy Hill <[email protected]>
Newsgroups gmane.games.devel.mud.rom
Message-ID <[email protected]>
Three things:
1) This code ignores doors. You'll have to add that functionality yourself.
2) This code ignores NPCS.
3) This code uses ch_printf.  If you don't have it, or something 
similar, then you'll have to rewrite those lines.

void do_pull (CHAR_DATA * ch, char *argument)
{
    char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH];
    CHAR_DATA *victim;
    argument = one_argument (argument, arg);
    bool success = FALSE;
    int door;
   
    if (arg[0] == '\0' || argument[0] == '\0')
    {
        send_to_char ("Pull whom to your room?\n\r", ch);
        return;
    }

    if ((victim = get_char_world (ch, arg)) == NULL || (IS_NPC (victim))
    {
        send_to_char ("They aren't here.\n\r", ch);
        return;
    }
   
    for (door = 0; door < 6; door++)
    {
        if ((pExit = ch->in_room->exit[door]) != NULL) &&
                    pExit->to_room == victim->in_room)
        {   
            char_from_room (victim);
            char_to_room (victim, ch->in_room);
            success = TRUE;
        }           
    }
       
    if (success)
        ch_printf("Pulled %s to your room.\n\r", victim->name);
    else
        ch_printf("%s isn't nearby.\n\r", victim->name);      
}
   
-- 
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.