Just a simple question,how do you make an item that is only usable once?Example:I made an item and tapped it on the ground and received resources,but that item got used and disappeared.How do you do that?Please give me the code if ya know how to!TYIA :)!
function useItem(x, y, z, itemId, blockId, side)
{
if(itemId == //ID)
{
Player.addItemInventory(//ID, -1, 0);
}
}
Although onedan's code works this will get rid of the entire stack of items in that hand, with my code it takes away one so if you have 32 and use one you have 31
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Just a simple question,how do you make an item that is only usable once?Example:I made an item and tapped it on the ground and received resources,but that item got used and disappeared.How do you do that?Please give me the code if ya know how to!TYIA :)!
function useItem(x,y,z,i,b){
if(i==*your id*){
Entity.setCarriedItem(getPlayerEnt(),0, 0,0);
}
}
function useItem(x, y, z, itemId, blockId, side) { if(itemId == //ID) { Player.addItemInventory(//ID, -1, 0); } }Although onedan's code works this will get rid of the entire stack of items in that hand, with my code it takes away one so if you have 32 and use one you have 31