Skip to content

Remove Item

Featured Replies

hello there im try to set remove item when u request rebirth but they give me error

can you help me

 

public boolean playerIsEligible(L2PcInstance player, int itemId, int itemAmount)
{
String itemName = ItemTable.getInstance().getTemplate(itemId).getName();
player.getInventory().getItemByItemId(itemId);

// Player has the required items, so we're going to take them!
player.getInventory().addItem("Rebirth Engine", itemId, itemAmount, player, null);
player.getInventory().removeItem("Rebirth Engine", 3470, 100, player, null);
   player.sendMessage("Removed 100 gold bar from your inventory!");

itemName = null;
return true;
}

Edited by haskovo

You don't make checks about null or quantity. The 2 first lines are pointless.

 

L2PcInstance got destroyItem() method with message attribute. Basically you only have to :

if (player.destroyItem())
{
    player.addItem();
    return true;
}
return false;

Edited by Tryskell

Guest
This topic is now closed to further replies.

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.