AErofas Posted May 15, 2017 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 23 Reputation: 1 Joined: 01/20/12 Last Seen: August 2, 2024 Share Posted May 15, 2017 (edited) Hi, I need help I got an error on compile with a command @whosell, I got this script on this forum rA /*========================================== * @whosell command *------------------------------------------*/ ACMD_FUNC(whosell) { struct map_session_data *pl_sd, *b_sd[MAX_SEARCH]; struct s_mapiterator* iter; struct item_data *item_array[MAX_SEARCH]; int total[MAX_SEARCH], amount[MAX_SEARCH]; unsigned int MinPrice[MAX_SEARCH], MaxPrice[MAX_SEARCH]; char output[256]; int i, j, count = 1; char item_name[100]; int minprice = 0; if (!message || !*message || ( sscanf(message, "\"%99[^\"]\" %11d", item_name, &minprice) < 1 && sscanf(message, "%99s %11d", item_name, &minprice) < 1) ) { clif_displaymessage(fd, "Please, enter Item name or its ID (usage: @whosell <item name or ID> {<min price>})."); return -1; } if ((item_array[0] = itemdb_searchname(item_name)) == NULL && (item_array[0] = itemdb_exists(atoi(item_name))) == NULL) count = itemdb_searchname_array(item_array, MAX_SEARCH, message); if (count < 1) { // No items found clif_displaymessage(fd, msg_txt(sd,19)); return -1; } if (count > MAX_SEARCH) count = MAX_SEARCH; // Preparing Search Recorders for (i = 0; i < MAX_SEARCH; i++) { total[i] = amount[i] = MaxPrice[i] = 0; MinPrice[i] = battle_config.vending_max_value + 1; b_sd[i] = NULL; } iter = mapit_getallusers(); for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) { if (!pl_sd->vender_id) continue; for (i = 0; i < pl_sd->vend_num; i++) { // Searching in the Vending List for (j = 0; j < count; j++) { // Compares with each search result if (pl_sd->status.cart[pl_sd->vending[i].index].nameid != item_array[j]->nameid) continue; if (pl_sd->vending[i].value < minprice) continue; amount[j] += pl_sd->vending[i].amount; total[j]++; if (pl_sd->vending[i].value < MinPrice[j]) { // Best Price MinPrice[j] = pl_sd->vending[i].value; b_sd[j] = pl_sd; } if (pl_sd->vending[i].value > MaxPrice[j]) MaxPrice[j] = pl_sd->vending[i].value; } } } mapit_free(iter); for (i = 0; i < count; i++) { if (total[i] > 0 && b_sd[i] != NULL) { sprintf(output, "[%d] The best price found for '%s' is %u sold by '%s' at %s <%d,%d>. Max Price %u. Item found in %d shops, %d pieces for sale.", item_array[i]->nameid, item_array[i]->jname, MinPrice[i], b_sd[i]->status.name, map[b_sd[i]->bl.m].name, b_sd[i]->bl.x, b_sd[i]->bl.y, MaxPrice[i], total[i], amount[i]); if (sd->bl.m == b_sd[i]->bl.m) clif_viewpoint(sd, 1, 1, b_sd[i]->bl.x, b_sd[i]->bl.y, i, 0xFFFFFF); } else sprintf(output, "[%d] '%s' is not being sold at the moment...", item_array[i]->nameid, item_array[i]->jname); clif_displaymessage(sd->fd, output); } return 0; } It always crash with mmo_char_status Quote if (pl_sd->status.cart[pl_sd->vending.index].nameid != item_array[j]->nameid) continue; How do I fix this? thankyou Edited May 15, 2017 by AErofas Quote Link to comment Share on other sites More sharing options...
0 Ninja Posted May 15, 2017 Group: Members Topic Count: 54 Topics Per Day: 0.01 Content Count: 513 Reputation: 84 Joined: 08/11/12 Last Seen: July 4, 2024 Share Posted May 15, 2017 can you please post a screenshot of the exact error? Quote Link to comment Share on other sites More sharing options...
0 AErofas Posted May 15, 2017 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 23 Reputation: 1 Joined: 01/20/12 Last Seen: August 2, 2024 Author Share Posted May 15, 2017 This my screenshot, error on mmo_charstatus Quote Link to comment Share on other sites More sharing options...
0 andrelobo Posted June 5, 2017 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 1 Reputation: 0 Joined: 05/07/14 Last Seen: March 22, 2020 Share Posted June 5, 2017 I have the same problem! Did someone solve it? Quote Link to comment Share on other sites More sharing options...
0 Ninja Posted June 5, 2017 Group: Members Topic Count: 54 Topics Per Day: 0.01 Content Count: 513 Reputation: 84 Joined: 08/11/12 Last Seen: July 4, 2024 Share Posted June 5, 2017 (edited) There was a structure change for map_sessiondata. Idk when was it made but it moved cart out of status struct. just change it to: if (pl_sd->cart.u.items_cart[pl_sd->vending[i].index].nameid != item_array[j]->nameid) continue; Full code: /*========================================== * @whosell command *------------------------------------------*/ ACMD_FUNC(whosell) { struct map_session_data *pl_sd, *b_sd[MAX_SEARCH]; struct s_mapiterator* iter; struct item_data *item_array[MAX_SEARCH]; int total[MAX_SEARCH], amount[MAX_SEARCH]; unsigned int MinPrice[MAX_SEARCH], MaxPrice[MAX_SEARCH]; char output[256]; int i, j, count = 1; char item_name[100]; int minprice = 0; if (!message || !*message || ( sscanf(message, "\"%99[^\"]\" %11d", item_name, &minprice) < 1 && sscanf(message, "%99s %11d", item_name, &minprice) < 1) ) { clif_displaymessage(fd, "Please, enter Item name or its ID (usage: @whosell <item name or ID> {<min price>})."); return -1; } if ((item_array[0] = itemdb_searchname(item_name)) == NULL && (item_array[0] = itemdb_exists(atoi(item_name))) == NULL) count = itemdb_searchname_array(item_array, MAX_SEARCH, message); if (count < 1) { // No items found clif_displaymessage(fd, msg_txt(sd, 19)); return -1; } if (count > MAX_SEARCH) count = MAX_SEARCH; // Preparing Search Recorders for (i = 0; i < MAX_SEARCH; i++) { total[i] = amount[i] = MaxPrice[i] = 0; MinPrice[i] = battle_config.vending_max_value + 1; b_sd[i] = NULL; } iter = mapit_getallusers(); for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) { if (!pl_sd->vender_id) continue; for (i = 0; i < pl_sd->vend_num; i++) { // Searching in the Vending List for (j = 0; j < count; j++) { // Compares with each search result if (pl_sd->cart.u.items_cart[pl_sd->vending[i].index].nameid != item_array[j]->nameid) continue; if (pl_sd->vending[i].value < minprice) continue; amount[j] += pl_sd->vending[i].amount; total[j]++; if (pl_sd->vending[i].value < MinPrice[j]) { // Best Price MinPrice[j] = pl_sd->vending[i].value; b_sd[j] = pl_sd; } if (pl_sd->vending[i].value > MaxPrice[j]) MaxPrice[j] = pl_sd->vending[i].value; } } } mapit_free(iter); for (i = 0; i < count; i++) { if (total[i] > 0 && b_sd[i] != NULL) { sprintf(output, "[%d] The best price found for '%s' is %u sold by '%s' at %s <%d,%d>. Max Price %u. Item found in %d shops, %d pieces for sale.", item_array[i]->nameid, item_array[i]->jname, MinPrice[i], b_sd[i]->status.name, map[b_sd[i]->bl.m].name, b_sd[i]->bl.x, b_sd[i]->bl.y, MaxPrice[i], total[i], amount[i]); if (sd->bl.m == b_sd[i]->bl.m) clif_viewpoint(sd, 1, 1, b_sd[i]->bl.x, b_sd[i]->bl.y, i, 0xFFFFFF); } else sprintf(output, "[%d] '%s' is not being sold at the moment...", item_array[i]->nameid, item_array[i]->jname); clif_displaymessage(sd->fd, output); } return 0; } Screenshot: Edited June 5, 2017 by Ninja Quote Link to comment Share on other sites More sharing options...
0 Ninja Posted June 5, 2017 Group: Members Topic Count: 54 Topics Per Day: 0.01 Content Count: 513 Reputation: 84 Joined: 08/11/12 Last Seen: July 4, 2024 Share Posted June 5, 2017 Just found out about this "Catalog" feature that RO has and is already supported in rAthena. It can open the store that's selling the item right then and there. http://www.playragnarok.com/news/updatedetail.aspx?id=183 in the source they are outlined as /// Search Store System void clif_search_store_info_ack(struct map_session_data* sd); void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason); void clif_open_search_store_info(struct map_session_data* sd); void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y); in the script commands *searchstores <uses>,<effect>; Invokes the store search window, which allows to search for both vending and buying stores. Parameter uses indicates, how many searches can be started, before the window has to be reopened. Effect value affects, what happens, when a result item is double-clicked and can be one of the following: 0 = Shows the store's position on the mini-map and highlights the shop sign with yellow color, when the store is on same map as the invoking player. 1 = Directly opens the shop, regardless of distance. Example: // Item Universal_Catalog_Gold (10 uses, effect: open shop) searchstores 10,1; 2 Quote Link to comment Share on other sites More sharing options...
Question
AErofas
Hi, I need help I got an error on compile with a command @whosell, I got this script on this forum rA
It always crash with mmo_char_status
How do I fix this? thankyou
Edited by AErofasLink to comment
Share on other sites
5 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.