viewing paste Unknown #760 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
/*==========================================
 * Creación de items en el suelo, en un Area.
 *------------------------------------------*/
ACMD_FUNC(flooritem)
{
    char item_name[100];
    int number = 0, count;
    struct item_data *item_data;
    nullpo_retr(-1, sd);
 
    memset(item_name, '\0', sizeof(item_name));
 
    if( !message || !*message || (
        sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 &&
        sscanf(message, "%99s %d", item_name, &number) < 1
    )) {
        clif_displaymessage(fd, "Usage: @flooritem <itemname/itemid> [quantity]");
        return -1;
    }
 
    if( number <= 0 )
        number = 1;
 
    if ((item_data = itemdb_searchname(item_name)) == NULL &&
        (item_data = itemdb_exists(atoi(item_name))) == NULL)
    {
        clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name.
        return -1;
    }
 
    count = map_addflooritem_area(&sd->bl, 0, 0, 0, item_data->nameid, number);
 
    if( count != 0 )
        if( number == count )
            clif_displaymessage(fd, "All items created.");
        else
        {
            sprintf(atcmd_output, "%d item(s) created.", count);
            clif_displaymessage(fd, atcmd_output);
        }
    else {
        clif_displaymessage(fd, "No items created!!.");
        return -1;
    }
 
    return 0;
Viewed 621 times, submitted by Guest.