@name Angel
@inputs 
@outputs 
@persist [Light LightNo LightToggle Halo Red Blue Rainboww I Fire1 Break Fire Rainbow Green]:number 
@persist [PPos]:vector [Prop]:entity [Props]:array 
@trigger all
interval(100)
runOnChat(1)
#variables
P = owner()
E = entity()
LS = P:lastSaid()
Chat = chatClk(P)
#first
if(first()){
    hint("type /help for help!",10)
    Red = 255
    Blue = 255
    Green = 255
    function hide(){
            hideChat(1)
            printColor(vec(0,0,255),"[Hidden]",vec(random(0,255),random(0,255),random(0,255)),+P:name(),vec(255,255,255),": "+LS)
    }
}
#stop from reaching hard tick quota
if(ops()>=maxquota()){
    Break = 1
    hint("Hard Tick Quota Almost Reached; All of your holos and lights are deleted.",10)
    Light = 0
    LightNo = 0
    LightToggle = 0
    Halo = 0
    lightRemoveAll()
    holoDeleteAll()
    Fire = 0
}
#/help
if(Chat & LS == "/help"){
    hide()
    hint("Help printed in chat.",10)
    print("/help - shows help menu.")
    print("/remove - removes all command(s) effects.")
    print("/halo - gives you a halo.")
    print("/light - spawns a light below your feet.")
    print("/clear - clears all spawned lights.")
    print("/randomcolor - your lights have a random color.")
    print("Hold down right mouse button and the use key to spawn a light a cursor's pos.")
    print("SCROLL UP FOR MORE COMMANDS.")
}
#/light command
if(Chat & LS == "/light" &!LightToggle){
    hint("Type /light again to remove all lights.",10)
    hide()
    Light = 1
    timer("lightoggle",100)
}
if(clk("lightoggle")){
    LightToggle = 1
}
if(LightToggle & Chat & LS == "/light"){
    hint("Lights Removed!",10)
    hide()
    Light = 0
    lightRemove(-1)
    LightToggle = 0
}
if(Light){
    lightCreate(-1)
    lightParent(-1, P)
    lightDistance(-1, 10000)
    lightPos(-1, P:pos())
    lightColor(-1,round(P:pos()))
    lightBrightness(-1, 100000)
}
#/create light at aim pos
if(changed(P:keyUse())&P:keyUse()&P:keyAttack2()){
    LightNo++
    lightCreate(LightNo)
    lightDistance(LightNo, 10000)
    lightPos(LightNo, P:aimPos())
    lightColor(LightNo,vec(Red,Green,Blue))
    lightBrightness(LightNo, 100000)
    LightRem = (lightRemainingSpawns())
    if(LightRem == 0){
        LightRem = 0
    }
    hint("Lights remaining: "+LightRem:toString(),10)
}
#/remove command
if(Chat & LS == "/remove"){
    hint("All Lights and Holos Removed!",10)
    hide()
    Light = 0
    LightNo = 0
    LightToggle = 0
    Halo = 0
    Fire = 0
    stopAllTimers()
    lightRemoveAll()
    holoDeleteAll()
}
#/clear command
if(Chat & LS == "/clear"){
    hint("All Lights Removed!",10)
    hide()
    lightRemoveAll()
    LightNo = 0
    Red = 255
    Blue = 255
    Green = 255
}
#/halo command
if(Chat & !Halo & LS == "/halo"){
    hide()
    timer("Halo",100)
    hint("You Now Have A Halo!",10)
}
if(clk("Halo")){
    Halo = 1
}
if(Halo){
    lightCreate(-2)
    lightColor(-2, vec(255,100,0))
    lightParent(-2,holoEntity(-1))
    lightBrightness(-2, 10000)
    lightDistance(-2,1000)
    lightPos(-2, holoEntity(-1):pos())
    holoCreate(-1, P:pos()+vec(0,0,80), vec(1,1,1))
    holoColor(-1,vec(255,155,0))
    holoParentAttachment(-1, P, "eyes")
    holoModel(-1, "torus3")
    if(Chat & Halo & LS == "/halo"){
        Halo = 0
        hide()
        hint("Halo Removed!",10)
        lightRemove(-2)
        holoDelete(-1)
}
}
#/randomcolor
if(Chat & LS == "/randomcolor"){
    hide()
    Red = random(0,255)
    Blue = random(0,255)
    Green = random(0,255)
    hint("Color (RGB Vector Format): "+round(Red)+" "+round(Green)+" "+round(Blue),10)
}
#/fire
if(Chat &!Fire & LS == "/fire"){
    hide()
    PPos = P:pos()
    timer("fire",100)
}
if(clk("fire")){
    Fire = 1
}
if(Fire){
    for (I = 1, 1){
        holoCreate(I)
        holoModel(I, "cone")
        holoScale(I, vec(random(0,3),random(0,3),random(0,3)))
        holoPos(I, PPos+vec(random(0,10)))
        holoColor(I,vec(random(100,255),random(100,255),0))
        holoCreate(I+1)
        holoModel(I+1, "cone")
        holoScale(I+1, vec(random(0,3),random(0,3),random(0,3)))
        holoPos(I+1, PPos+vec(random(0,5)))
        holoColor(I+1,vec(random(100,255),random(100,255),0))
        holoCreate(I+2)
        holoModel(I+2, "cone")
        holoScale(I+2, vec(random(0,3),random(0,3),random(0,3)))
        holoPos(I+2, PPos+vec(random(0,5)))
        holoColor(I+2,vec(random(100,255),random(100,255),0))
        holoCreate(I+3)
        holoModel(I+3, "cone")
        holoScale(I+3, vec(random(0,5),random(0,3),random(0,3)))
        holoPos(I+3, PPos+vec(random(0,10)))
        holoColor(I+3,vec(random(100,255),random(100,255),0))
        lightCreate(I)
        lightPos(I,holoEntity(I):pos())
        lightCreate(I+1)
        lightPos(I+1,holoEntity(I+1):pos())
        lightColor(I,vec(random(100,255),random(100,255),0))
        lightColor(I+1,vec(random(100,255),random(100,255),0))
        holoEntity(I):soundPlay(0,0,"ambient/fire/fire_small_loop1.wav")
        if(Break == 1 | Chat & LS == "/fire"){
            holoDelete(I)
            holoDelete(I+1)
            holoDelete(I+2)
            holoDelete(I+3)
            lightRemove(I)
            lightRemove(I+1)
            break
        }
    }
}
if(Fire & Props:count()<5){
    Prop = propSpawn("models/props_phx/construct/wood/wood_boardx1.mdl", holoEntity(I+1):pos(), holoEntity(I+1):angles(),0)
    Props:pushEntity(Prop)
}
if(Chat & LS == "/fire"&Fire){
    hide()
    hint("Fire Removed",10)
    holoDelete(I)
    holoDelete(I+1)
    holoDelete(I+2)
    holoDelete(I+3)
    lightRemove(I)
    lightRemove(I+1)
    Fire = 0
    soundStop(0,0)
    Props:propDelete()
    Props:clear()
    PropsNo = 0
    }

if(duped()){
    reset()
}
