Jump to content
  • 0

getinventorylist help


Reborn

Question


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

Hi everyone. Does anyone know how to do this? Basically what I need is a script that can check the item equipment of a player which is not equip and remove it all from the players inventory.

 

example:

A player has a 3 Silk Robe (ID:2321) and 5 Shoes (ID:2403) in his inventory. When the player clicks this NPC, all of his 3 Silk Robe and 5 Shoes in his inventory will be removed and he will get an item in exchange like Red Potion.

 

I am tying to use this one but I cant seem to make it work. It can only remove an item one at a time which is not what I want.

if( countitem(2321) == 1 ){
getinventorylist;
for (set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 )
if ( @inventorylist_id[.@i] == 2321 )
set .count01, @inventorylist_amount[.@i];
delitem 2321, .count01;
getitem 501,.count01;
}
if( countitem(2403) == 1 ){
getinventorylist;
for (set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 )
if ( @inventorylist_id[.@i] == 2403 )
set .count01, @inventorylist_amount[.@i];
delitem 2403, .count01;
getitem 501,.count01;
}

I hope someone can help me with this one...

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

setarray .@item_to_remove[0],
	2321,
	2403;
.@size_item_to_remove = getarraysize( .@item_to_remove );

for ( .@i = 0; .@i < .@size_item_to_remove; .@i++ ) {
	.@count = countitem( .@item_to_remove[.@i] );
	.@total_item += .@count;
	delitem .@item_to_remove[.@i], .@count;
}

getitem 501, .@total_item;

 

12 hours ago, neXus said:

which is not equip

What do you mean?

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

thanks capuche. Its working that way I like it however this script is getting all the equipment in players inventory. How can I make this script get a certain type of equipement in players inventory?

Like when a player has a 3 Silk Robe (ID:2321) and 5 Shoes (ID:2403) in his inventory. When the player clicks this NPC, all of his 3 Silk Robe and 5 Shoes in his inventory will be removed and he will get an item in exchange.

 

Silk Robe (ID:2321) = 1 or 3 Red Potion

Shoes (ID:2403) = 5 or 8 White Potion

its not going to be a rand function (rand(1,3) or rand(5,8)). It should be 1 OR 3 got Red Potion and 5 OR 8 for White Potion

 

Only Silk Robe (ID:2321) and Shoes (ID:2403) is the one that will be removed. not included the other equipments in players inventory.

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...