FutureGazer Posted July 29, 2013 Posted July 29, 2013 (edited) work on my version 17348.......but a bit problem......help me to settle this pc.c: In function âpc_getitem_mapâ: pc.c:4102: warning: suggest parentheses around assignment used as truth value the script on that line(4102): if ( flag = pc_additem(sd,&it,count,log_type) ) script.c: In function âbuildin_getitem_map_subâ: script.c:6460: warning: unused variable âpâ script.c:6459: warning: unused variable âgâ the script on that line(6460): struct party_data *p = NULL; the script on that line(6459): struct guild *g = NULL; atcommand.c: In function âatcommand_itemmapâ: atcommand.c:1275: warning: suggest parentheses around â&&â within â||â the script on that line(1275): && sscanf(message, "%99s %d", item_name, &amount) < 1 ) thx so much for ur help...... Edited July 29, 2013 by FutureGazer Quote
Boy Posted September 25, 2013 Posted September 25, 2013 Hi rAthena Need help i got this error Anyone can help me for this error? Quote
Lord Ganja Posted November 2, 2013 Posted November 2, 2013 any updates about this? is this working on the latest revision? Quote
Norse Posted December 7, 2013 Posted December 7, 2013 any updates about this? is this working on the latest revision? Quote
Nerfwood Posted December 24, 2013 Posted December 24, 2013 (edited) Hi rAthena Need help i got this error I'm getting the an error like this. atcommand.c: In function \u2018atcommand_itemmap\u2019: atcommand.c:1315: warning: suggest parentheses around && within || atcommand.c:1336:37: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:1336: error: \u2018msg_txt\u2019 undeclared (first use in this function) atcommand.c:1336: error: (Each undeclared identifier is reported only once atcommand.c:1336: error: for each function it appears in.) atcommand.c:1362:39: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:1367: warning: implicit declaration of function \u2018pc_getitem_map\u2019 atcommand.c:1372:39: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:1390:36: error: macro "msg_txt" requires 2 arguments, but only 1 given make[1]: *** [obj_sql/atcommand.o] Error 1 make[1]: Leaving directory `/root/Desktop/trunk/src/map' make: *** [map] Error 2 I don't know what to do! haha Edit: Ok so I changed the msg_txt but now I get these: obj_sql/atcommand.o: In function `atcommand_itemmap': /root/Desktop/trunk/src/map/atcommand.c:1384: undefined reference to `pc_getitem_map' /root/Desktop/trunk/src/map/atcommand.c:1367: undefined reference to `pc_getitem_map' /root/Desktop/trunk/src/map/atcommand.c:1377: undefined reference to `pc_getitem_map' collect2: ld returned 1 exit status make[1]: *** [map-server] Error 1 make[1]: Leaving directory `/root/Desktop/trunk/src/map' make: *** [map] Error 2 Edited December 24, 2013 by kalkalkal Quote
Lelouch vi Britannia Posted October 13, 2014 Posted October 13, 2014 I got the same error post #28 and #32 got atcommand.c: In function ‘atcommand_itemmap’: atcommand.c:1406: warning: suggest parentheses around ‘&&’ within ‘||’ atcommand.c:1427:37: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:1427: error: ‘msg_txt’ undeclared (first use in this function) atcommand.c:1427: error: (Each undeclared identifier is reported only once atcommand.c:1427: error: for each function it appears in.) atcommand.c:1453:39: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:1463:39: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:1481:36: error: macro "msg_txt" requires 2 arguments, but only 1 given make[1]: *** [obj/atcommand.o] Error 1 make[1]: Leaving directory `/root/Desktop/trunk/src/map' make: *** [map] Error 2 Quote
darking123 Posted October 19, 2014 Posted October 19, 2014 update this one please to support the latest rev Quote
HappyMan Posted October 21, 2014 Posted October 21, 2014 i need help atcommand.c:10126: error: expected identifier or '(' before '/' token atcommand.c:10127: error: stray '@' in program atcommand.c:10128: error: expected identifier or '(' before numeric constant atcommand.c:10128: error: stray '@' in program atcommand.c:10129: error: stray '@' in program atcommand.c:10177:37: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:10203:39: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:10213:39: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:10231:36: error: macro "msg_txt" requires 2 arguments, but only 1 given atcommand.c:10239: error: redefinition of 'atcommand_itemreset' atcommand.c:1363: error: previous definition of 'atcommand_itemreset' was here atcommand.c: In function 'atcommand_itemreset': atcommand.c:10241: error: stray '@' in program atcommand.c:10241: error: stray '@' in program atcommand.c:10241: warning: left-hand operand of comma expression has no effect atcommand.c:10241: error: stray '@' in program atcommand.c:10241: error: stray '@' in program atcommand.c:10242: warning: left-hand operand of comma expression has no effect atcommand.c:10242: warning: statement with no effect atcommand.c:10242: error: expected ';' before '{' token atcommand.c:10251: error: expected declaration or statement at end of input atcommand.c:10240: warning: unused variable 'i' make[1]: *** [obj_sql/atcommand.o] Error 1 make[1]: Leaving directory `/root/trunk/src/map' make: *** [map] Error 2 Quote
Radian Posted November 11, 2014 Posted November 11, 2014 can some make this source code compatible with the latest version? for me its a useful command. anyone? Quote
viths06 Posted October 23, 2015 Posted October 23, 2015 Hey Emistry please apply it to r17726 latest Thanks in advance Quote
Elsa Mist Posted October 23, 2015 Posted October 23, 2015 lol? U cant ask Emistry just like that... Quote
Oliver Posted October 4, 2016 Posted October 4, 2016 (edited) Helpppppp. Recompiling was not successful 1> atcommand.c 1> script.c 1>..\src\map\atcommand.c(1418): warning C4003: not enough actual parameters for macro 'msg_txt' 1>..\src\map\atcommand.c(1418): warning C4047: 'function' : 'map_session_data *' differs in levels of indirection from 'int' 1>..\src\map\atcommand.c(1418): warning C4024: 'map_msg_txt' : different types for formal and actual parameter 1 1>..\src\map\atcommand.c(1418): error C2059: syntax error : ')' 1>..\src\map\atcommand.c(1444): warning C4003: not enough actual parameters for macro 'msg_txt' 1>..\src\map\atcommand.c(1444): warning C4047: 'function' : 'map_session_data *' differs in levels of indirection from 'int' 1>..\src\map\atcommand.c(1444): warning C4024: 'map_msg_txt' : different types for formal and actual parameter 1 1>..\src\map\atcommand.c(1444): error C2059: syntax error : ')' 1>..\src\map\atcommand.c(1454): warning C4003: not enough actual parameters for macro 'msg_txt' 1>..\src\map\atcommand.c(1454): warning C4047: 'function' : 'map_session_data *' differs in levels of indirection from 'int' 1>..\src\map\atcommand.c(1454): warning C4024: 'map_msg_txt' : different types for formal and actual parameter 1 1>..\src\map\atcommand.c(1454): error C2059: syntax error : ')' 1>..\src\map\atcommand.c(1472): warning C4003: not enough actual parameters for macro 'msg_txt' 1>..\src\map\atcommand.c(1472): warning C4047: 'function' : 'map_session_data *' differs in levels of indirection from 'int' 1>..\src\map\atcommand.c(1472): warning C4024: 'map_msg_txt' : different types for formal and actual parameter 1 1>..\src\map\atcommand.c(1472): error C2059: syntax error : ')' 1>..\src\map\script.c(6506): error C2198: 'itemdb_searchrandomid' : too few arguments for call Edited October 16, 2016 by Emistry Please use CODEBOX. Quote
onlineteam Posted December 7, 2016 Posted December 7, 2016 (edited) after paste in files. delete + ??? Edited December 7, 2016 by onlineteam Quote
anacondaq Posted December 7, 2016 Posted December 7, 2016 (edited) 1 hour ago, onlineteam said: after paste in files. delete + ??? I have checked it, and a little bit edit it, + few tests. Looks like works fine, but not sure (because i have no time for now, but you can test it by yourself if you wish). Here is actual modified updated manual patch, just follow instructions, it's not "git patch", because my emulator very customized, and i do not have clean rA. ============================================================================ 1. add to /doc/script_commands.txt (anywhere, but better if to end of file): ============================================================================ *getitem_map <item id>,<amount>,"<mapname>"{,<type>,<ID for Type>}; This command will give a specific amount of specified items to the players on the specified map. Works similarly to getitem but for multiple players on certain map. Negative ID numbers also apply. However item name is currently not supported. Those parameters that are different from 'getitem' are: mapname - Map name of the players to give the item(s) too type - Optional. Type 0 = everyone on the map (default) 1 = specific party and their members on the map 2 = specific guild and their members on the map 3 = specific battleground team and their members on the map ID for Type - Only needed if type is not 0 If type = 1, ID is Party ID If type = 2, ID is Guild ID If type = 3, ID is Battleground ID If type is given, party members who are offline or are not on the specific map do not get the item. Same for guild members. If BG ID is not found, it will not give to any players. This transaction is logged if the log script generated transactions option is enabled. Created by Xantara --------------------------------------- ============================================================= 2. create npc at npc/test/npc_getitem_map.txt with next code: ============================================================= // Sample NPC to test the custom getitem_map script command // Script and command created by Xantara prontera,156,170,3 script getitem_map test 120,{ mes "input item id"; next; input .@id; mes "input item amount"; next; input .@amt; mes "input type:"; mes "0=everyone, 1=party, 2=guild 3=bg"; next; input .@t; //getitem_map .@id,.@amt,strcharinfo(3),.@t,((.@t==1) ? getcharid(1) : (.@t==2) ? getcharid(2) : getcharid(4)); switch(.@t) { case 1: set .@type_id, getcharid(1); break; case 2: set .@type_id, getcharid(2); break; case 3: set .@type_id, getcharid(4); break; } getitem_map .@id,.@amt,strcharinfo(3),.@t,.@type_id; mes "done"; close; } ================================================================ 3. open src/custom/atcommand.inc and add next code to this file: ================================================================ /*========================================== * 0 = @itemmap <item id/name> {<amount>} * 1 = @itemmap1 <item id/name> <amount>, <party name> * 2 = @itemmap2 <item id/name> <amount>, <guild name> * [Xantara] *------------------------------------------*/ 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(sd,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(sd,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[i].sd && map == p->data[i].sd->bl.m ) pc_getitem_map(p->data[i].sd,it,amount,get_count,LOG_TYPE_COMMAND); break; case 2: if( (g = guild_searchname(guild_name)) == NULL ) { clif_displaymessage(fd, msg_txt(sd,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[i].sd && map == g->member[i].sd->bl.m ) pc_getitem_map(g->member[i].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(sd,18)); // Item created. return 0; } ==================================================================== 4. open src/custom/atcommand_def.inc and add next code to this file: ==================================================================== ACMD_DEF(itemmap), ACMD_DEF2("itemmap1", itemmap), ACMD_DEF2("itemmap2", itemmap), ACMD_DEF2("itemmap3", itemmap), ============================================================= 5. open src/custom/script.inc and add next code to this file: ============================================================= /*==================================================================== * [Xantara] * getitem_map <item id>,<amount>,"<mapname>"{,<type>,<ID for Type>}; * @param: type: 0=everyone, 1=party, 2=guild, 3=bg =====================================================================*/ static int buildin_getitem_map_sub(struct block_list *bl,va_list ap) { struct item it; struct guild *g = NULL; struct party_data *p = NULL; int amt,count; TBL_PC *sd = (TBL_PC *)bl; it = va_arg(ap,struct item); amt = va_arg(ap,int); count = va_arg(ap,int); pc_getitem_map(sd,it,amt,count,LOG_TYPE_SCRIPT); return 0; } BUILDIN_FUNC(getitem_map) { struct item it; struct guild *g = NULL; struct party_data *p = NULL; struct battleground_data *bg = NULL; struct script_data *data; int m,i,get_count,nameid,amount,flag=0,type=0,type_id=0; const char *mapname; data = script_getdata(st,2); get_val(st,data); if( data_isstring(data) ) { const char *name = conv_str(st,data); struct item_data *item_data = itemdb_searchname(name); if( item_data ) nameid = item_data->nameid; else nameid = UNKNOWN_ITEM_ID; } else nameid = conv_num(st,data); if( (amount = script_getnum(st,3)) <= 0 ) return 0; mapname = script_getstr(st,4); if( (m = map_mapname2mapid(mapname)) < 0 ) return 0; if( script_hasdata(st,5) ){ type = script_getnum(st,5); type_id = script_getnum(st,6); } if(nameid < 0) { nameid = itemdb_searchrandomid(1,-nameid); flag = 1; } if( nameid <= 0 || !itemdb_exists(nameid) ){ ShowError("buildin_getitem_map: Nonexistant item %d requested.\n", nameid); return 1; //No item created. } memset(&it,0,sizeof(it)); it.nameid = nameid; if(!flag) it.identify = 1; else it.identify = itemdb_isidentified(nameid); if (!itemdb_isstackable(nameid)) get_count = 1; else get_count = amount; switch(type) { case 1: if( (p = party_search(type_id)) != NULL ) { for( i=0; i < MAX_PARTY; i++ ) if( p->data[i].sd && m == p->data[i].sd->bl.m ) pc_getitem_map(p->data[i].sd,it,amount,get_count,LOG_TYPE_SCRIPT); } break; case 2: if( (g = guild_search(type_id)) != NULL ) { for( i=0; i < g->max_member; i++ ) if( g->member[i].sd && m == g->member[i].sd->bl.m ) pc_getitem_map(g->member[i].sd,it,amount,get_count,LOG_TYPE_SCRIPT); } break; case 3: if( (bg = bg_team_search(type_id)) != NULL ) { for( i=0; i < MAX_BG_MEMBERS; i++ ) if( bg->members[i].sd && m == bg->members[i].sd->bl.m ) pc_getitem_map(bg->members[i].sd,it,amount,get_count,LOG_TYPE_SCRIPT); } break; default: map_foreachinmap(buildin_getitem_map_sub,m,BL_PC,it,amount,get_count); break; } return 0; } ================================================================= 6. open src/custom/script_def.inc and add next code to this file: ================================================================= BUILDIN_DEF(getitem_map,"iis??"), ================================================================================================== 7. open src/map/pc.c and add next code to the file, (better if after function pc_job_can_entermap) ================================================================================================== /*------------------------------------------ * pc_getitem_map [Xantara] *------------------------------------------*/ int pc_getitem_map(struct map_session_data *sd,struct item it,int amt,int count,e_log_pick_type log_type) { int i, flag; nullpo_ret(sd); for ( i = 0; i < amt; i += count ) { if ( !pet_create_egg(sd,it.nameid) ) { // if not pet egg if ( flag = pc_additem(sd,&it,count,log_type) ) { clif_additem(sd, 0, 0, flag); if( pc_candrop(sd,&it) ) map_addflooritem(&it,count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0); } } } log_pick_pc(sd, log_type, -amt, &sd->inventory.u.items_inventory[i]); return 1; } ================================================================================================== 8. open src/map/pc.h and add next code to the file, (better if after declaration of pc_readparam): ================================================================================================== int pc_getitem_map(struct map_session_data *sd,struct item it,int amt,int count,e_log_pick_type log_type); // [Xantara] ================================================================================================== 9. open src/map/pc.h and add next code to the file, (better if after declaration of pc_readparam): ================================================================================================== Recompile, and have fun! atcommands, script commands has been a little bit tested, and looks like tested. Source updates date: 07 December 2016, by anacondaq for latest rAthena revision Original Author: [Xantara] Anyway, here is alternative link: MEGA | dropbox Edited December 7, 2016 by Anacondaqq Quote
ChadN4u Posted December 17, 2016 Posted December 17, 2016 Dont forget change if (amount <= 0) To: If(amount <= 0 || amount == NULL) If you only type "@itemmap Apple" Will causing crash map server Quote
Ukiram Posted April 24, 2019 Posted April 24, 2019 Is this working in latest rAthena rev? Thank you! Quote
Schmerz Posted January 11, 2020 Posted January 11, 2020 Hi is there a guide how to apply this patch in cPanel? i would like to use this to my currently running server but i dont know how to install it correctly. Hope somebody can help Quote
Mabuhay Posted January 11, 2020 Posted January 11, 2020 36 minutes ago, Schmerz said: Hi is there a guide how to apply this patch in cPanel? i would like to use this to my currently running server but i dont know how to install it correctly. Hope somebody can help 1 Quote
Schmerz Posted January 11, 2020 Posted January 11, 2020 Wow Sir i tried it and no hassle it worked! thanks a lot ! upvoted! Quote
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.