@name AimtoPaint
@inputs 
@outputs 
@persist Select
@trigger 
runOnChat(1)



O = owner()

CMD = O:lastSaid():explode(" ")

Obj = O:aimEntity()

OB = Obj:getConstraints()

High = array(entity())

Num = OB:count()

Num2 = High:count()

Color = vec(0,255,255)
Texture = "models/props/CS_militia/roofbeams02"
if(chatClk(owner())){
if(CMD:string(1) == "!paint"){
    Obj:setMaterial(O:lastSaid():sub(8))
    }
if(CMD:string(1) == "!wood"){

    Obj:setMaterial("models/props/CS_militia/roofbeams01")

    }
if(CMD:string(1) == "!window"){
    Obj:setMaterial("models/shadertest/predator")
    }
if(CMD:string(1) == "!paintall"){
    for(I=1,Num){
        OB[I, entity]:setMaterial(Texture)
        
        }
    
    }
if(CMD:string(1) == "!clear"){
    Obj:setMaterial(Obj:model())
    
    }
if(CMD:string(1) == "!clearall"){
    for(I=1, Num){
        OB[I, entity]:setMaterial(OB[I, entity]:model())
        }
    
    }
    
    if(O:keyAttack1() == 1 & CMD:string(1) =="!on"){
        Obj:setMaterial(Texture)
        }
}

