I am making a flying mod but when I test it, it doesn't work. What's the problem?
var GemFly = 500;
function useItem(x, y, z, itemId, blockId, side, itemDamage, blockDamage) {
if (itemId == 500) {
Player.addItemInventory(500, -1);
Player.setCanFly(1); clientMessage("You feel the power of flight rushing through your veins!"); Entity.addEffect(getPlayerEnt(), MobEffect.jump, 7800, 1001, false, false);
for (time = 0; time<= 6000; time++) {
if (time == 1200) clientMessage("You have 4 minute left!");
if (time == 2400) clientMessage("You have 3 minute left!");
if (time == 3600) clientMessage("You have 2 minute left!");
if (time == 4800) clientMessage("You have 1 minute left!");
if (time == 6000) {
clientMessage("The powers of flight leaves your body");
Player.setCanFly(0);
}
}
}
}
}
This is the code for my Flying Mod. However, when I try to activate it, it does not work or consume the item. What is wrong with the code? Thanks!
P.S. What is suppose to happen is when I tap the gem(Id=500) on smth, it activates flight for 5 minutes.
function useItem(x, y, z, itemId, blockId, side, itemDamage, blockDamage) {
if (itemId == 500) {
Player.addItemInventory(500, -1);
Player.setCanFly(1); clientMessage("You feel the power of flight rushing through your veins!"); Entity.addEffect(getPlayerEnt(), MobEffect.jump, 7800, 1001, false, false);
for (time = 0; time<= 6000; time++) {
if (time == 1200) clientMessage("You have 4 minute left!");
if (time == 2400) clientMessage("You have 3 minute left!");
if (time == 3600) clientMessage("You have 2 minute left!");
if (time == 4800) clientMessage("You have 1 minute left!");
if (time == 6000) {
clientMessage("The powers of flight leaves your body");
Player.setCanFly(0);
}
}
}
}
}
if (time == 1200) clientMessage("You have 4 minute left!");
if (time == 2400) clientMessage("You have 3 minute left!");
if (time == 3600) clientMessage("You have 2 minute left!");
if (time == 4800) clientMessage("You have 1 minute left!");
if (time == 6000) {
time = 0;
canFly = false;
clientMessage("The powers of flight leaves your body");
Player.setCanFly(0);
}
}
}
function useItem(x, y, z, itemId, blockId, side, itemDamage, blockDamage) {
if (itemId == 500) {
Player.addItemInventory(500, -1);
canFly = true;
Player.setCanFly(1); clientMessage("You feel the power of flight rushing through your veins!"); Entity.addEffect(getPlayerEnt(), MobEffect.jump, 7800, 1001, false, false);
I am making a flying mod but when I test it, it doesn't work. What's the problem?
var GemFly = 500; function useItem(x, y, z, itemId, blockId, side, itemDamage, blockDamage) { if (itemId == 500) { Player.addItemInventory(500, -1); Player.setCanFly(1); clientMessage("You feel the power of flight rushing through your veins!"); Entity.addEffect(getPlayerEnt(), MobEffect.jump, 7800, 1001, false, false); for (time = 0; time<= 6000; time++) { if (time == 1200) clientMessage("You have 4 minute left!"); if (time == 2400) clientMessage("You have 3 minute left!"); if (time == 3600) clientMessage("You have 2 minute left!"); if (time == 4800) clientMessage("You have 1 minute left!"); if (time == 6000) { clientMessage("The powers of flight leaves your body"); Player.setCanFly(0); } } } } }Hi....
This is the code for my Flying Mod. However, when I try to activate it, it does not work or consume the item. What is wrong with the code? Thanks!
P.S. What is suppose to happen is when I tap the gem(Id=500) on smth, it activates flight for 5 minutes.
function useItem(x, y, z, itemId, blockId, side, itemDamage, blockDamage) { if (itemId == 500) { Player.addItemInventory(500, -1); Player.setCanFly(1); clientMessage("You feel the power of flight rushing through your veins!"); Entity.addEffect(getPlayerEnt(), MobEffect.jump, 7800, 1001, false, false); for (time = 0; time<= 6000; time++) { if (time == 1200) clientMessage("You have 4 minute left!"); if (time == 2400) clientMessage("You have 3 minute left!"); if (time == 3600) clientMessage("You have 2 minute left!"); if (time == 4800) clientMessage("You have 1 minute left!"); if (time == 6000) { clientMessage("The powers of flight leaves your body"); Player.setCanFly(0); } } } } }Hi....
function modTick() {
if(canFly == true) {
time++;
if (time == 1200) clientMessage("You have 4 minute left!");
if (time == 2400) clientMessage("You have 3 minute left!");
if (time == 3600) clientMessage("You have 2 minute left!");
if (time == 4800) clientMessage("You have 1 minute left!");
if (time == 6000) {
time = 0;
canFly = false;
clientMessage("The powers of flight leaves your body");
Player.setCanFly(0);
}
}
}
function useItem(x, y, z, itemId, blockId, side, itemDamage, blockDamage) {
if (itemId == 500) {
Player.addItemInventory(500, -1);
canFly = true;
Player.setCanFly(1); clientMessage("You feel the power of flight rushing through your veins!"); Entity.addEffect(getPlayerEnt(), MobEffect.jump, 7800, 1001, false, false);
}
}