@name 60 Seconds
@inputs 
@outputs 
@persist F:array Index
@trigger 

runOnChat(1)

if(first() | dupefinished()){
    Index = 1
    On = 0
    }


function void resetC(A:array){
    for(I=1, A:count()){A[I, entity]:setColor(vec(255,255,255))}
    }


if(first() | duped()){
    findByModel("models/hunter/misc/sphere025x025.mdl")
    findSortByDistance(entity():pos())
    F = findToArray()
    for(I=1, F:count()){
        F[I, entity]:setMaterial("models/debug/debugwhite")
        }
    for(I=2, F:count()){
            F[I, entity]:setColor(vec(255,255,255))
            }
    F[1, entity]:setColor(vec(0,0,255))
    
    }

timer("Trig", 1000)

if(clk("Trig") & On){
    Index++
    F[Index, entity]:setColor(vec(0,0,255))
    }
if(On==0){
    resetC(F)
    Index = 1
    }


if(chatClk(owner())){
    Chat = owner():lastSaid():explode(" ")
    C1 = Chat:string(1)
    switch(C1){
        case "/reset",
        hideChat(1)
        resetC(F)
        break
        
        case "/on",
        hideChat(1)
        On=1
        break
        
        case "/off",
        hideChat(1)
        On=0
        break
        
        }
    }
