Cyrix Posted November 25, 2016 Group: Members Topic Count: 44 Topics Per Day: 0.01 Content Count: 150 Reputation: 13 Joined: 02/16/12 Last Seen: April 10, 2023 Share Posted November 25, 2016 (edited) Hi, I need help to get itemid card2 from script.c function "successremovecards": BUILDIN_FUNC(successremovecards) { int i=-1,c,cardflag=0; TBL_PC* sd = script_rid2sd(st); int num = script_getnum(st,2); if (equip_index_check(num)) i=pc_checkequip(sd,equip_bitmask[num]); if (i < 0 || !sd->inventory_data[i]) { return SCRIPT_CMD_SUCCESS; } if(itemdb_isspecial(sd->inventory.u.items_inventory[i].card[0])) return SCRIPT_CMD_SUCCESS; // code to verify item.tmp card2 start here, and can be with sql query or other code; // example: // if (item.tmp.card[2].nameid >4900){ // message item.tmp.card[2].nameid // }else{ for( c = sd->inventory_data[i]->slot - 1; c >= 0; --c ) { if( sd->inventory.u.items_inventory[i].card[c] && itemdb_type(sd->inventory.u.items_inventory[i].card[c]) == IT_CARD ) {// extract this card from the item unsigned char flag = 0; struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); cardflag = 1; item_tmp.nameid = sd->inventory.u.items_inventory[i].card[c]; item_tmp.identify = 1; if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory clif_additem(sd,0,0,flag); map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0); } } } if(cardflag == 1) {//if card was remove remplace item with no card unsigned char flag = 0, j; struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = sd->inventory.u.items_inventory[i].nameid; item_tmp.identify = 1; item_tmp.refine = sd->inventory.u.items_inventory[i].refine; item_tmp.attribute = sd->inventory.u.items_inventory[i].attribute; item_tmp.expire_time = sd->inventory.u.items_inventory[i].expire_time; item_tmp.bound = sd->inventory.u.items_inventory[i].bound; for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++) item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j]; for (j = 0; j < MAX_ITEM_RDM_OPT; j++){ item_tmp.option[j].id=sd->inventory.u.items_inventory[i].option[j].id; item_tmp.option[j].value=sd->inventory.u.items_inventory[i].option[j].value; item_tmp.option[j].param=sd->inventory.u.items_inventory[i].option[j].param; } pc_delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT); if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor clif_additem(sd,0,0,flag); map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0); } clif_misceffect(&sd->bl,3); } return SCRIPT_CMD_SUCCESS; } // end itemid verify // } Edited November 25, 2016 by Cyrix Quote Link to comment Share on other sites More sharing options...
Question
Cyrix
Hi,
I need help to get itemid card2 from script.c function "successremovecards":
Edited by CyrixLink to comment
Share on other sites
0 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.