Created
September 22, 2018 03:32
-
-
Save gravcat/7c74072d25308cb4af22dd44063438d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@name Smart Opener | |
@inputs | |
@outputs Door | |
@persist P:array Distance:array A:array Target:entity D Z | |
@trigger | |
runOnChat(1) | |
interval(300) | |
#Distance | |
D = 120 | |
O = owner() | |
# | |
S = owner():lastSaid():explode(" ") | |
if(S[1,string]=="/add" & chatClk(owner())){ | |
hideChat(1) | |
TP = findPlayerByName(S[2,string]) | |
if(TP:isPlayer()){ | |
Target = TP | |
P:pushEntity(TP) | |
} | |
} | |
if(S[1,string]=="/remove"& chatClk(owner())){ | |
hideChat(1) | |
TP = findPlayerByName(S[2,string]) | |
if(TP:isPlayer()){ | |
while(Z < 20){ | |
if(TP == P[Z,entity]) | |
{ | |
P:remove(Z) | |
} | |
Z++ | |
} | |
} | |
Z = 0 | |
} | |
Distance1 = round(((entity():pos() - P[1,entity]:pos()):length())) | |
Distance2 = round(((entity():pos() - P[2,entity]:pos()):length())) | |
Distance3 = round(((entity():pos() - P[3,entity]:pos()):length())) | |
Distance4 = round(((entity():pos() - P[4,entity]:pos()):length())) | |
Distance5 = round(((entity():pos() - P[5,entity]:pos()):length())) | |
Distance6 = round(((entity():pos() - P[6,entity]:pos()):length())) | |
Distance7 = round(((entity():pos() - P[7,entity]:pos()):length())) | |
Distance8 = round(((entity():pos() - P[8,entity]:pos()):length())) | |
Distance9 = round(((entity():pos() - P[9,entity]:pos()):length())) | |
Distance10 = round(((entity():pos() - P[10,entity]:pos()):length())) | |
Door = 0 | |
if(Distance1<D&P[1,entity]:isAlive()){Door = 1 | |
}elseif(Distance2<D&P[2,entity]:isAlive()){Door = 1 | |
}elseif(Distance3<D&P[3,entity]:isAlive()){Door = 1 | |
}elseif(Distance4<D&P[4,entity]:isAlive()){Door = 1 | |
}elseif(Distance5<D&P[5,entity]:isAlive()){Door = 1 | |
}elseif(Distance6<D&P[6,entity]:isAlive()){Door = 1 | |
}elseif(Distance7<D&P[7,entity]:isAlive()){Door = 1 | |
}elseif(Distance8<D&P[8,entity]:isAlive()){Door = 1 | |
}elseif(Distance9<D&P[9,entity]:isAlive()){Door = 1 | |
}elseif(Distance10<D&P[10,entity]:isAlive()){Door = 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment