@name Interactive Targeting For Privacy 
@inputs N
@outputs Targets:array TID Sorted:array
@persist Players:array Chat1:string Last 
Time = 250
interval(Time)
entity():setColor(0,140,255)
Command = "jack"
Menu = "menu"
Attack = "get" 
List = "list"
P1 = "1"
P2 = "2"
P3 = "3"
P4 = "4"
P5 = "5"
P6 = "6"
P7 = "7"
P8 = "8"
P9 = "9"
P10 = "0"
S = " "
Origin = entity():pos()
findInSphere(Origin,1000000)
findSortByDistance(Origin)
findIncludeClass("player")
Players = findToArray()

Owner = entity():owner()
Chat = Owner:lastSaid()
K=curtime()-Owner:lastSaidWhen()<Time*2/1000
C = Chat:find(Command)
M = Chat:find(Menu)
A = Chat:find(Attack)
L = Chat:find(List)
C1 = Chat:find(P1)
C2 = Chat:find(P2)
C3 = Chat:find(P3)
C4 = Chat:find(P4)
C5 = Chat:find(P5)
C6 = Chat:find(P6)
C7 = Chat:find(P7)
C8 = Chat:find(P8)
C9 = Chat:find(P9)
C10 = Chat:find(P10)


Concat = array()
if (Players:count()>0) {
Concat:setString(1,"Targets: ")
Concat:setString(2,P1+S)
Concat:setString(3,Players:entity(1):name())
}
if (Players:count()>1) {
Concat:setString(4,S+P2+S)
Concat:setString(5,Players:entity(2):name())
}
if (Players:count()>2) {
Concat:setString(6,S+P3+S)
Concat:setString(7,Players:entity(3):name())
}
if (Players:count()>3) {
Concat:setString(8,S+P4+S)
Concat:setString(9,Players:entity(4):name())
}
if (Players:count()>4) {
Concat:setString(10,S+P5+S)
Concat:setString(11,Players:entity(5):name())
}
if (Players:count()>5) {
Concat:setString(12,S+P6+S)
Concat:setString(13,Players:entity(6):name())
}
if (Players:count()>6) {
Concat:setString(14,S+P7+S)
Concat:setString(15,Players:entity(7):name())
}
if (Players:count()>7) {
Concat:setString(16,S+P8+S)
Concat:setString(17,Players:entity(8):name())
}
if (Players:count()>8) {
Concat:setString(17,S+P9+S)
Concat:setString(18,Players:entity(9):name())
}
if (Players:count()>9) {
Concat:setString(19,S+P10+S)
Concat:setString(20,Players:entity(10):name())
}


if(C&K){
if (M) {print(Concat:concat())}
if (A) {
    Targets = array()
    E = 1
    if (C1) {Targets:setEntity(E,Players:entity(1)) E+=1}
    if (C2) {Targets:setEntity(E,Players:entity(2)) E+=1}
    if (C3) {Targets:setEntity(E,Players:entity(3)) E+=1}
    if (C4) {Targets:setEntity(E,Players:entity(4)) E+=1}
    if (C5) {Targets:setEntity(E,Players:entity(5)) E+=1}
    if (C6) {Targets:setEntity(E,Players:entity(6)) E+=1}
    if (C7) {Targets:setEntity(E,Players:entity(7)) E+=1}
    if (C8) {Targets:setEntity(E,Players:entity(8)) E+=1}
    if (C9) {Targets:setEntity(E,Players:entity(9)) E+=1}
    if (C10) {Targets:setEntity(E,Players:entity(10)) E+=1}
}

TID = Targets:entity(N):id()
if (L) {print(Targets:concat())}
}#End of C&K

Count = Targets:count()
D1=D2=D3=D4=D5=D6=D7=D8=D9=D10=1000000
Dist = array()
if (Count>0) {D1 = Targets:entity(1):pos():distance(Origin)} 
if (Count>1) {D2 = Targets:entity(2):pos():distance(Origin)} 
if (Count>2) {D3 = Targets:entity(3):pos():distance(Origin)} 
if (Count>3) {D4 = Targets:entity(4):pos():distance(Origin)} 
if (Count>4) {D5 = Targets:entity(5):pos():distance(Origin)} 
if (Count>5) {D6 = Targets:entity(6):pos():distance(Origin)} 
if (Count>6) {D7 = Targets:entity(7):pos():distance(Origin)} 
if (Count>7) {D8 = Targets:entity(8):pos():distance(Origin)} 
if (Count>8) {D9 = Targets:entity(9):pos():distance(Origin)} 
if (Count>9) {D10 = Targets:entity(10):pos():distance(Origin)} 
Dist:setNumber(1,D1)
Dist:setNumber(2,D2)
Dist:setNumber(3,D3)
Dist:setNumber(4,D4)
Dist:setNumber(5,D5)
Dist:setNumber(6,D6)
Dist:setNumber(7,D7)
Dist:setNumber(8,D8)
Dist:setNumber(9,D9)
Dist:setNumber(10,D10)
K1 = Dist:minIndex()
Dist:remove(K1)
K2 = Dist:minIndex()
Dist:remove(K2)
K3 = Dist:minIndex()
Dist:remove(K3)
K4 = Dist:minIndex()
Dist:remove(K4)
K5 = Dist:minIndex()
Dist:remove(K5)
K6 = Dist:minIndex()
Dist:remove(K6)
K7 = Dist:minIndex()
Dist:remove(K7)
K8 = Dist:minIndex()
Dist:remove(K8)
K9 = Dist:minIndex()
Dist:remove(K9)
K10 = Dist:minIndex()
Dist:remove(K10)

Cz=1
Sorted:setEntity(Cz,Targets:entity(K1)) Cz++
Sorted:setEntity(Cz,Targets:entity(K2)) Cz++
Sorted:setEntity(Cz,Targets:entity(K3)) Cz++
Sorted:setEntity(Cz,Targets:entity(K4)) Cz++
Sorted:setEntity(Cz,Targets:entity(K5)) Cz++
Sorted:setEntity(Cz,Targets:entity(K6)) Cz++
Sorted:setEntity(Cz,Targets:entity(K7)) Cz++
Sorted:setEntity(Cz,Targets:entity(K8)) Cz++
Sorted:setEntity(Cz,Targets:entity(K9)) Cz++
Sorted:setEntity(Cz,Targets:entity(K10)) Cz++

