void do_objroom(CHAR_DATA *ch, char *argument )
{       char buf[MIL];
        OBJ_DATA *obj;
        OBJ_INDEX_DATA *pObjIndex;
        bool found = FALSE;
        int nMatch = 0;
        int count = 0;
        char arg[MSL];

        if ( argument[0] == '\0' )
   {    send_to_char( "You can't count nothing?\n\r", ch );
            return;
   }
        /*Added*/
        if( !is_number(argument) )
        {       stc("It must be a number.\n\r",ch);
                return;
        }
        nMatch = atoi(argument);

        if ( IS_NPC(ch) )
        {       stc("Yeah, Whatever.\n\r", ch);
       return;
        }
        /* Added */
        for( obj = ch->in_room->contents ; obj ; obj = obj->next_content )
        {       if( can_see_obj(ch, obj) )
                        count++;
                if(count == nMatch)
                {       found = TRUE;
                        break;
                }
        }
        if(!found)
        {       send_to_char("Object not found.\n\r",ch);
                return;
        }
        obj->short_descr = arg;
        sprintf(buf, "This room has (%d)%s in it\n\r", count, arg);
        stc(buf,ch);
        return;
}


This should do what you want. I hope ;)

Davion

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


Reply via email to