Jump to content

Question

Posted (edited)

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

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

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.


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..