I am making an AntiGief mod this is just a test to see how it works then im gonna make it into a PocketMine plugin.
I have
function destroyBlock(x, y, z, side){
preventDefault();
Now im trying to do if it senses that a certian ITEM ID is on a block it will remove that delete the item thats not supposted to be there. I can do commands i just can't figure out the code for that.
var THEITEM=0 /*Change this to whatever item you want gone.*/
var itemId;
function useItem(x,y,z,side) {
preventDefault();
itemId=Entity.getCarriedItem(getPlayerEnt());
if (itemId==THEITEM) {
Entity.setCarriedItem(getPlayerEnt(),0,0);
}
}
This should work. If you mine a block, provided you changed THEITEM to a value other than 0, then if the item's id matches up to THEITEM, then the item gets wiped.
I am making an AntiGief mod this is just a test to see how it works then im gonna make it into a PocketMine plugin.
function destroyBlock(x, y, z, side){
preventDefault();
Now im trying to do if it senses that a certian ITEM ID is on a block it will remove that delete the item thats not supposted to be there. I can do commands i just can't figure out the code for that.
var THEITEM=0 /*Change this to whatever item you want gone.*/
var itemId;
function useItem(x,y,z,side) {
preventDefault();
itemId=Entity.getCarriedItem(getPlayerEnt());
if (itemId==THEITEM) {
Entity.setCarriedItem(getPlayerEnt(),0,0);
}
}
This should work. If you mine a block, provided you changed THEITEM to a value other than 0, then if the item's id matches up to THEITEM, then the item gets wiped.
I have nothing to say...
so if i wanted the the to be lava the code would be like this.
Nonono the only thing you want to change is what the variable THEITEM represents, NOT where it is used
I have nothing to say...
So it would be like this
}
}
var THEITEM=11
var itemId;
function useItem(x,y,z,side) {
preventDefault();
itemId=Entity.getCarriedItem(getPlayerEnt());
if (11===THEITEM)
Entity.setCarriedItem(getPlayerEnt(),0,0);
}
}
Semicolon after var THEITEM, and switch 11 and THEITEM inside of the if statement.
I have nothing to say...
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumNot necessary, but only == and not === in the if statement.