Skip to content

[Help] JScript delete item code?

Featured Replies

Hello, I would like to ask what code should i use to delete an item. I imported L2ItemInstance and PcInventory and then i tried this code:

 

getInventory().destroyItemByItemId("heroweap", 6611, 1, st, null);

and i also tried to add st. in front, like this

 

st.getInventory().destroyItemByItemId("heroweap", 6611, 1, st, null);

 

But still i get an error on getInventory. What can i do?

you need to get the inventory of a player....st.getPlayer()...(ofc st only if its a quest state)

  • Author

I did it like this:

 

getPlayer().getInventory().destroyItemByItemId("heroweap", 6611, 1, st, null);

 

but i gets an error with getPlayer :S

What can i do?

I did it like this:

 

getPlayer().getInventory().destroyItemByItemId("heroweap", 6611, 1, st, null);

 

but i gets an error with getPlayer :S

What can i do?

 

1st you either declare a player value or you use st.getPlayer()

2nd st is not a proper object reference st.getPlayer() is

  • Author

i used this now:

st.getPlayer().getInventory().destroyItemByItemId("heroweap", 6611, 1, st, null);

 

Still not working :S any other idea?

it says error null :S

i used this now:

st.getPlayer().getInventory().destroyItemByItemId("heroweap", 6611, 1, st, null);

 

Still not working :S any other idea?

it says error null :S

 

i told st is not an object reference st.getPlayer() is...

  • Author

I dont understand you lol, please tell me what to use to delete that item. im confused lol

I dont understand you lol, please tell me what to use to delete that item. im confused lol

 

for example player.destroyItemByItemId("Quest", DARION_BADGE, 20, npc, true)

 

or st.getPlayer().destroyItemByItemId("Quest", DARION_BADGE, 20, npc, true)

 

read always the method reference to see which value need what...

pfff doesnt work :S

 

what pack you have...

  • Author

i have 2, brasil and l2j, none of them working. but i am planning to use it on brasil

i have 2, brasil and l2j, none of them working. but i am planning to use it on brasil

 

so shitlude than thats why i dont know the il methods xD

How can i fix it now? :/

 

well look into your core or into other scripts for examples

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.