@name Cenn's Alarm
@outputs Door
@persist P:array Distance:array A:array Target:entity D Z Placed I ALARM Name:array
@trigger
if(first()){F = vec(255,255,0) B = vec(0,0,255)
    Placed = 0
    holoCreate(2)
    ALARM = 0
    GG = propSpawn("models/props_junk/PlasticCrate01a.mdl",holoEntity(2):pos() + vec(0,0,30),1)
GG:parentTo(holoEntity(2))
    }
runOnChat(1)
runOnTick(1)
#Distance
D = 80
#

S = owner():lastSaid():explode(" ")
if(S[1,string]=="/add" & chatClk(owner())){
    TP = findPlayerByName(S[2,string])
    hideChat(1)
    if(TP:isPlayer()){
        Target = TP
        P:pushEntity(TP) 
           }
    
}
if(S[1,string]=="/remove"& chatClk(owner())){
    TP = findPlayerByName(S[2,string])
    hideChat(1)
    if(TP:isPlayer()){
        while(Z < 20){
        if(TP == P[Z,entity])
        {
        P:remove(Z)
        }
        Z++
}
}
Z = 0
}
if(findCanQuery()){
    if(Placed==1){
    findIncludeClass("player")
L = findInBox(entity():pos(),GG:pos())
Name = findToArray()
#print(_HUD_PRINTCENTER,Name)
}
}
print(Name[I,entity]:toString())
for(I=1,Name:count()){
        if(Name[I,entity]:name() != P[I,entity]:name()){
        ALARM=1}
        else{ALARM=0}
        }
        
        if(ALARM==1){print("test")}
        #[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()))
]#

#[
if(Distance1<D){Door = 1
}elseif(Distance2<D){Door = 1
}elseif(Distance3<D){Door = 1
}elseif(Distance4<D){Door = 1
}elseif(Distance5<D){Door = 1
}elseif(Distance6<D){Door = 1
}elseif(Distance7<D){Door = 1
}elseif(Distance8<D){Door = 1
}elseif(Distance9<D){Door = 1
}

else{Door = 0}
]#

if(owner():weapon():type()=="weapon_physcannon"){
    if(Placed==0){
    holoPos(2,owner():aimPos())
    if(owner():keyAttack1()){
  if(Placed==0){  
    Placed=1
}}
}}
