nasagnilac Posted February 11, 2014 Posted February 11, 2014 for(set .@i,0; .@i < getarraysize(@inventorylist_id); set .@i,.@i+1){ for(set .@k,0; .@k<getarraysize(.delitems); set .@k,.@k+1){ if(@inventorylist_id[.@i] == .delitems[.@k]){ delitem .delitems[.@k],@inventorylist_amount[.@k]; } } } I have a problem with this it says. [Error]: script:delitem: failed to delete 3 items (AID=2000000 item_id=14003). [Debug]: Source (NPC): mainevent (invisible/not on a map) Please help me. Quote
Euphy Posted February 11, 2014 Posted February 11, 2014 Read the error. You have to check if the player has the items (i.e. Countitem) before you try to delete them. Quote
nasagnilac Posted February 12, 2014 Author Posted February 12, 2014 got it. getinventorylist; for(set .@k,0; .@k<getarraysize(.delitems); set .@k,.@k+1){ if(countitem(.delitems[.@k])>0){ delitem .delitems[.@k],@inventorylist_amount[.@k]; } } is this one correct now? Quote
Emistry Posted February 12, 2014 Posted February 12, 2014 getinventorylist; while( .@i < @inventorylist_count ){ delitem @inventorylist_id[.@i],@inventorylist_amount[.@i]; .@i++; } end; all item will be deleted. Quote
nasagnilac Posted February 12, 2014 Author Posted February 12, 2014 no I just want to delete this list setarray .delitem[0],5288,5401,5471,515,5362,5361,5462,5225,5420,5313,5375,5389,5325,5463,5372,5379, 5137,5377,5800,18511,5376,5314,5155,18510,18508,18509,18506,5423,5224,4035,4092, 4004,4043,4031,4058,4133,4381,4079,4064,2310,2102,2504,2404,2621,2624,1208,1108, 1117,1408,1464,1302,1352,1514,1602,1705,1802,1902,1953,1550,1251,25001,14003,645, 657,656,678,12009,1751,715,716,717,7136,7135; setarray .delitems[0],14003,645,657,656,678,12009,1751,715,716,717,7136,7135; Quote
Emistry Posted February 12, 2014 Posted February 12, 2014 setarray .delitem[0],5288,5401,5471,515,5362,5361,5462,5225,5420,5313,5375,5389,5325,5463,5372,5379, 5137,5377,5800,18511,5376,5314,5155,18510,18508,18509,18506,5423,5224,4035,4092, 4004,4043,4031,4058,4133,4381,4079,4064,2310,2102,2504,2404,2621,2624,1208,1108, 1117,1408,1464,1302,1352,1514,1602,1705,1802,1902,1953,1550,1251,25001,14003,645, 657,656,678,12009,1751,715,716,717,7136,7135; setarray .delitems[0],14003,645,657,656,678,12009,1751,715,716,717,7136,7135; .delitem_size = getarraysize( .delitem ); .delitems_size = getarraysize( .delitems ); // array 1 while( .@item1 < .delitem_size ){ .@i = countitem( .delitem[.@item1] ); if( .@i ) delitem .delitem[.@item1],.@i; .@item1++; } // array 2 while( .@item2 < .delitems_size ){ .@i = countitem( .delitems[.@item2] ); if( .@i ) delitem .delitems[.@item2],.@i; .@item2++; } Quote
nasagnilac Posted February 12, 2014 Author Posted February 12, 2014 (edited) The problem now is it don't continue on this part no warping happens. set $teama$,0; set $teamb$,0; areawarp .Map$,66,60,79,77,"veil", 120, 110; // Team A areawarp .Map$,120,60,133,77,"veil", 120, 110; // Team B OnDoDismiss: deletearray .@acc[0],getarraysize(.@acc); query_sql("SELECT `account_id` FROM `char` WHERE `online` = '1'", .@acc); for(set .@i,0; .@i<getarraysize(.@acc); set .@i,.@i+1){ attachrid .@acc[.@i]; if(strcharinfo(3) != .Map$) {end;} unequip EQI_HEAD_TOP; unequip EQI_ARMOR; unequip EQI_HAND_L; unequip EQI_HAND_R; unequip EQI_GARMENT; unequip EQI_SHOES; unequip EQI_ACC_L; unequip EQI_ACC_R; unequip EQI_HEAD_MID; unequip EQI_HEAD_LOW; while( .@item1 < .delitem_size ){ .@i = countitem( .delitem[.@item1] ); if( .@i ) delitem .delitem[.@item1],.@i; .@item1++; } savepoint "veil", 120, 110; } set $teama$,0; set $teamb$,0; areawarp .Map$,66,60,79,77,"veil", 120, 110; // Team A areawarp .Map$,120,60,133,77,"veil", 120, 110; // Team B end; Edited February 13, 2014 by gmprestige Quote
Emistry Posted February 14, 2014 Posted February 14, 2014 change the FOR-LOOP variable or the variable i used in my sample script ...currently both are using same variable .. Quote
Question
nasagnilac
I have a problem with this it says.
Please help me.
8 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.