@name Cenn's Admin Goto Chip
@inputs 
@outputs TIME Cancel PM READY ANTILOOP
@persist G:string N:string  H:string AFK:number YY GG:string HH:entity Array:array FF:number
@trigger 
if(dupefinished()|first()){
    TIME = 100
    ANTILOOP  = 0
runOnChat(1)
interval(1)
YY=-1
FF = 1
Cancel = 0
PM = 1
AFK = 0
setName("Automatic Admin Chip By Cenn")
timer("advert",1000)
READY = 0
}
if(owner():lastSaid():lower()=="!reset"){ reset()}
if(owner():lastSaid():lower()=="!afk"){AFK=1
    TIME = 100
    hint("You are now set to Automatic Mode",3000)
    concmd("say AUTO MODE ON")}
if(READY ==0){
G = lastSaid():lower()
N = lastSpoke():name()

}

if(G:find("admin")){
    if(N != owner():name()){
         
              timer("print",10)
        gSetStr(1,N)
        gSetStr(2,G)
        H = "!ADMIN"    
}
}
if(G:find("rdm")){
             timer("print",10)
        gSetStr(1,N)
        gSetStr(2,G)
        H = "rdm"     
        
}


if(G:find("prop surf")){
         timer("print",10)
        gSetStr(1,N)
        gSetStr(2,G)
        H = "propsurf"    
 
}
if(G:find("cdm")){
         timer("print",10)
                gSetStr(1,N)
        gSetStr(2,G)
          H = "CDM"   
 
}
if(G:find("minge")){
         timer("print",10)
                gSetStr(1,N)
        gSetStr(2,G)
          H = "Minge"   
 
}
if(G:find("propblock")){
         timer("print",10)     
           gSetStr(1,N)
        gSetStr(2,G)
          H = "Prop Block"   
 
}
if(G:find("prop block")){
         timer("print",10)
                gSetStr(1,N)
        gSetStr(2,G)
              H = "Prop Block"   
 
}
if(G:find("hacker")){
timer("print",10)
        gSetStr(1,N)
        gSetStr(2,G)
                  H = "hacker"   
 
}
if(G:find("hacking")){
timer("print",10)
        gSetStr(1,N)
        gSetStr(2,G)
                  H = "hacking"   
 
}
if(G:find("!c")){
Cancel =1
stoptimer("loop2")
stoptimer("loop")
 timer("reset",10000)
timer("pm",1500)
}
if(clk("pm")){
if(PM==1){
concmd("say /pm " + gGetStr(1) + " The Admin : " + owner():name() + " Is too busy currently to handle your request, please try again later.")}
PM = 0
}
if(clk("reset")){
    ANTILOOP = 0
    stoptimer("loop2")
stoptimer("loop")
READY = 1
    TIME = 500
    PM = 1
Cancel = 0}
if(clk("print")){
    timer("loop2",2)
}
if(clk("loop2")){
        timer("loop",2)
}
if(clk("loop")){
    timer("loop2",2)
}

if(clk("loop")){           
 if(gGetStr(1)!=owner():name()){
if(ANTILOOP==0){
    TIME = TIME - 1

    print(_HUD_PRINTCENTER, "You will be teleported to " + gGetStr(1) + " In " + TIME + " Ticks" + "--- For Reason : " + H)
    if(Cancel == 0){
        if(TIME == 0){
        if(ANTILOOP==0){

                    concmd("say /goto " + gGetStr(1))
                    Cancel =1
                    TIME = 500
                    READY = 1
                    ANTILOOP = 1
stoptimer("loop2")
stoptimer("loop")
 timer("reset",10000)
timer("say",1000)
                    
    }}
}}}
}
if(clk("say")){
    if(AFK==1){
        print("test")
concmd("say /pm " +gGetStr(1) +" Hello " +gGetStr(1)+ "," + " Thanks for summoning me! I am AFK. ")
timer("chat2",1000)
timer("chat3",2000)
#   
    HH = findPlayerByName(gGetStr(1))
timer("stop2",45000)
timer("loop3",100)
}
}
if(clk("chat2")){
    concmd("say /pm " +gGetStr(1) +" Please name the Offender and what they did in CHAT")}
    if(clk("chat3")){
concmd("say /pm " +gGetStr(1) +" ONLY and I will log it." + "You have 45 seconds to type. PLEASE ONLY 3 SENTENCES")    }
if(clk("loop3")){
    timer("loop4",100)

GG = HH:lastSaid():lower()
 timer("loop4",100)   
    
if(changed(GG)){
    fileAppend("ADMIN LOG.txt","\n" + HH:toString() + ":" +GG)
 Array = array()
print(YY)
YY++ 
Array:setString(YY,GG)
print(Array:string(YY))
}


}
if(clk("loop4")){timer("loop3",100)}
if(clk("stop2")){stoptimer("loop3")
    stoptimer("loop4")
    concmd("say /pm " +gGetStr(1) +" THE RECORDING SESSION IS OVER. Thank you for the report!")


     #   fileAppend("ADMIN LOG.txt",Array:string(1) + "         "+ Array:string(2) + "           " + Array:string(3))
    print(Array:string(1) + Array:string(2) + Array:string(3))
      owner():tele(entity():pos())
    reset()
}
if(owner():lastSaid()=="!ready"){
READY=0}

if(READY==0){
if(clk("advert")){
    if(AFK==0){
# concmd("say /advert Need an admin? Say !admin to have one brought to you!")
}
if(AFK==1){
  #   concmd("say /advert Need an admin? Say !admin to have a report bot brought to you!")

}
timer("advert", 50000)
}

}
if(owner():keyPressed("i")){
    print("test")
    reset()
}
