How do you make an "if" statement do multiple things
Just do an "if" and "else" statement. So "If" you do something, something happens or if the function doesn't happen, something "else" happens . Is this what you had in mind? O.o
Just do an "if" and "else" statement. So "If" you do something, something happens or if the function doesn't happen, something "else" happens . Is this what you had in mind? O.o
I meant to do multiple actions on the same call. I was thinking like:
if(getPlayerX()==x, getPlayerY()==y, getPlayerZ()==z){
setPosition(getPLayerEnt(), x, y, z);
}
It still didn't work.
What's wrong with this code?
var portalInX=0
var portalInY=0
var portalInZ=0
var portalOutX=0
var portalOutY=0
var portalOutZ=0
var portalActive=false
function useItem(x,y,z,itemId,blockId,side)
{
if(itemId==341){
portalActive=true
portalInX=portalInX+x
portalInY=portalInY+y
portalInZ=portalInZ+z
setTile(x,y,z,105);
clientMessage("Portal1 set to" + x +"-"+ y+"-" + z);
}
else if(itemId==345){
portalActive=true
portalOutX=portalOutX+x
portalOutY=portalOutY+y
portalOutZ=portalOutZ+z
setTile(x,y,z,105);
clientMessage("Portal2 set to" + x +"-"+ y+"-"+ z);
}
else if(getPlayerX()==portalInX && getPlayerY()==portalInY && getPlayerZ()=portalInZ){
setPosition(getPlayerEnt(), portalOutX, portalOutY, portalOutZ);
}
}
function attackHook(attacker, victim)
{
//Your Code Here
}
function modTick()
{
}
treebl, Instead of useing the button from System/Library/Frameworks/UIKit.framework/UIKit have you thought about making your own or using one from MCPE?
It still didn't work.
What's wrong with this code?
var portalInX=0
var portalInY=0
var portalInZ=0
var portalOutX=0
var portalOutY=0
var portalOutZ=0
var portalActive=false
function useItem(x,y,z,itemId,blockId,side)
{
if(itemId==341){
portalActive=true
portalInX=portalInX+x
portalInY=portalInY+y
portalInZ=portalInZ+z
setTile(x,y,z,105);
clientMessage("Portal1 set to" + x +"-"+ y+"-" + z);
}
else if(itemId==345){
portalActive=true
portalOutX=portalOutX+x
portalOutY=portalOutY+y
portalOutZ=portalOutZ+z
setTile(x,y,z,105);
clientMessage("Portal2 set to" + x +"-"+ y+"-"+ z);
}
else if(getPlayerX()==portalInX && getPlayerY()==portalInY && getPlayerZ()==portalInZ){
setPosition(getPlayerEnt(), portalOutX, portalOutY, portalOutZ);
}
}
function attackHook(attacker, victim)
{
//Your Code Here
}
function modTick()
{
}
How do you make an "if" statement do multiple things
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumCheck out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
Java/C/C++ dev, server owner and hacker extraordinare
I meant to do multiple actions on the same call. I was thinking like:
if(getPlayerX()==x, getPlayerY()==y, getPlayerZ()==z){ setPosition(getPLayerEnt(), x, y, z); }i need it.
Thanks.
If you like my mods, please donate!

if(getPlayerX()==x && getPlayerY()==y && getPlayerZ()==z){ setPosition(getPLayerEnt(), x, y, z); }Back to modding! Follow me on Twitter @byteandahalf
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou can use modTick to implement timers:
var ticksUntilExplosion = 700; function modTick() { ticksUntilExplosion--; if (ticksUntilExplosion <= 0) { explode(1,2,3,4); ticksUntilExplosion = 700; } }i dont speak computer
Made by: creeping_creepers
Made by: creeping_creepers
What's wrong with this code?
var portalInX=0 var portalInY=0 var portalInZ=0 var portalOutX=0 var portalOutY=0 var portalOutZ=0 var portalActive=false function useItem(x,y,z,itemId,blockId,side) { if(itemId==341){ portalActive=true portalInX=portalInX+x portalInY=portalInY+y portalInZ=portalInZ+z setTile(x,y,z,105); clientMessage("Portal1 set to" + x +"-"+ y+"-" + z); } else if(itemId==345){ portalActive=true portalOutX=portalOutX+x portalOutY=portalOutY+y portalOutZ=portalOutZ+z setTile(x,y,z,105); clientMessage("Portal2 set to" + x +"-"+ y+"-"+ z); } else if(getPlayerX()==portalInX && getPlayerY()==portalInY && getPlayerZ()=portalInZ){ setPosition(getPlayerEnt(), portalOutX, portalOutY, portalOutZ); } } function attackHook(attacker, victim) { //Your Code Here } function modTick() { }I fixed another error