@name raid
@inputs 
@outputs 
@persist E:entity H:entity Level:number Name:array Placed:number GG:entity
@trigger 

runOnTick(1)
if(first()){
E = entity()
Level = 0
holoCreate(2)
holoPos(2,entity():pos())
holoCreate(1)
GG = propSpawn("models/props_junk/PlasticCrate01a.mdl",holoEntity(2):pos() + vec(0,0,30),1)
GG:parentTo(holoEntity(2))
Placed=0
}
if(owner():weapon():type()=="weapon_physcannon"){
    if(Placed==0){
    holoPos(2,owner():aimPos())
    if(owner():keyAttack1()){
  if(Placed==0){  
    Placed=1
}}
}}

G = lastSaid()
H = lastSpoke()


if(G:lower():find("/advert")){
    Level =1
    timer("reset",5000)
}
if(G:lower():find("raid")){
    if(Level==1){
        stoptimer("reset")
            gSetStr(1,G)
    gSetStr(2,H:name())
    Level =2

}
}
if(clk("reset")){
Level =0}

if(findCanQuery()){
    if(Placed==1){
    findIncludeClass("player")
L = findInBox(entity():pos(),GG:pos())
Name = findToArray()
#print(_HUD_PRINTCENTER,Name)
}
}

for(I=1,Name:count()){
    Name2 = Name[I,entity]:name()
}

    

if(Name2 == gGetStr(2)){
    if(Level==2){
            print(_HUD_PRINTCENTER,gGetStr(2) + " is Raiding You!")
            timer("reset",500)
        }
    }
