Jump to content
  • 0

@itemmap Error [atcommand.c]


Question

Posted
i have an error -> atcommand.c:8464:38: error: macro "msg_txt" requires 2 arguments, but only 1 given
 
 

 

with this source
 
//*------------------------------------------*/
//ACMD_FUNC(itemmap)
{
    char item_name[100], party_name[NAME_LENGTH], guild_name[NAME_LENGTH];
    int amount, get_type = 0, flag = 0, get_count, i, map;
    struct item it;
    struct item_data *item_data;
    struct party_data *p;
    struct guild *g;
    struct s_mapiterator *iter = NULL;
    struct map_session_data *pl_sd = NULL;
 
    nullpo_retr(-1, sd);
    
    memset(item_name, '\0', sizeof(item_name));
    memset(party_name, '\0', sizeof(party_name));
    memset(guild_name, '\0', sizeof(guild_name));
 
    if (strstr(command, "1") != NULL)
        get_type = 1;
    else if (strstr(command, "2") != NULL)
        get_type = 2;
 
    if (!message || !*message || 
        get_type == 0 && sscanf(message, "\"%99[^\"]\" %d", item_name, &amount) < 1 
                      && sscanf(message, "%99s %d", item_name, &amount) < 1 )
    {
        clif_displaymessage(fd, "Please, enter an item name/id (usage: @itemmap <item name or ID> {amount}).");
        return -1;
    }
    if ( get_type == 1 && sscanf(message, "\"%99[^\"]\" %d, %23[^\n]", item_name, &amount, party_name) < 2 
                       && sscanf(message, "%99s %d, %23[^\n]", item_name, &amount, party_name) < 2 )
    {
        clif_displaymessage(fd, "Please, enter an item name/id (usage: @itemmap1 <item id/name> <amount>, <party name>).");
        return -1;
    }
    if ( get_type == 2 && sscanf(message, "\"%99[^\"]\" %d, %23[^\n]", item_name, &amount, guild_name) < 2 
                       && sscanf(message, "%99s %d, %23[^\n]", item_name, &amount, guild_name) < 2 )
    {
        clif_displaymessage(fd, "Please, enter an item name/id (usage: @itemmap2 <item id/name> <amount>, <guild name>).");
        return -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;
    }
 
    if (amount <= 0)
        amount = 1;    
 
    map = sd->bl.m;
    
    memset(&it,0,sizeof(it));
    it.nameid = item_data->nameid;
    if(!flag)
        it.identify = 1;
    else
        it.identify = itemdb_isidentified(item_data->nameid);
 
    if (!itemdb_isstackable(item_data->nameid))
        get_count = 1;
    else
        get_count = amount;
 
    switch(get_type)
    {
        case 1:
            if( (p = party_searchname(party_name)) == NULL )
            {
                clif_displaymessage((fd, msg_txt(96)); // Incorrect name or ID, or no one from the party is online.
                return -1;
            }
            for( i=0; i < MAX_PARTY; i++ )
                if( p->data.sd && map == p->data.sd->bl.m )
                    pc_getitem_map(p->data.sd,it,amount,get_count,LOG_TYPE_COMMAND);
            break;
        case 2:
            if( (g = guild_searchname(guild_name)) == NULL )
            {
                clif_displaymessage((fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online.
                return -1;
            }
            for( i=0; i < g->max_member; i++ )
                if( g->member.sd && map == g->member.sd->bl.m )
                    pc_getitem_map(g->member.sd,it,amount,get_count,LOG_TYPE_COMMAND);
            break;
        default:
            iter = mapit_getallusers();
            for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) {
                if( map != pl_sd->bl.m )
                    continue;
                pc_getitem_map(pl_sd,it,amount,get_count,LOG_TYPE_COMMAND);
            }
            mapit_free(iter);
            break;
    }
 
    clif_displaymessage((fd, msg_txt(18)); // Item created.
    return 0;
}

3 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...