Jump to content
  • 0

Delitem Problem help please


nasagnilac

Question


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

		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.

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Read the error. You have to check if the player has the items (i.e. Countitem) before you try to delete them.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

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?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

getinventorylist;
while( .@i < @inventorylist_count ){
	delitem @inventorylist_id[.@i],@inventorylist_amount[.@i];
	.@i++;
}
end;

all item will be deleted.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

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;
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  


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++;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

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 by gmprestige
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

bump

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

change the FOR-LOOP variable or the variable i used in my sample script ...currently both are using same variable ..

Link to comment
Share on other sites

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.

×
×
  • Create New...