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

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock