@name MP-inc Remote Trail maker
@inputs 
@outputs R G B A SSize ESize Length Texture:string
@persist R G B A SSize ESize Length Texture:string Players:array
runOnChat(1)
Last = lastSpoke()
Said = lastSaid():lower():explode(" ")
SID = Last:id()
C = chatClk()
CMD = Said[1,string]=="$"
Arg = Said[2,string]
if(first()){
    concmd("say [MP-inc Remote Trail maker Activated]")
}
if(C&CMD&Arg=="new"){
    SSize = 20
    ESize = 0
    Length = 2
    Texture = "laser"
    R = teamColor(Last:team()):x()
    G = teamColor(Last:team()):y()
    B = teamColor(Last:team()):z()
    A = 255
    holoEntity(SID):removeTrails()
    holoDelete(SID)
    holoCreate(SID)
    holoPos(SID,Last:pos()+vec(0,0,5))
    holoParent(SID,Last)
    holoScale(SID,vec(0,0,0))
    holoEntity(SID):setTrails(20,0,2,"trails/laser",teamColor(Last:team()),255)
    gSetNum(SID+"ssize",SSize)
    gSetNum(SID+"esize",ESize)
    gSetNum(SID+"length",Length)
    gSetStr(SID+"texture",Texture)
    gSetNum(SID+"r",R)
    gSetNum(SID+"g",G)
    gSetNum(SID+"b",B)
    gSetNum(SID+"a",A)
}
if(C&CMD&Arg=="ssize"){
    if(Said[3,string]:toNumber()>120){
        soundPurge()
        holoEntity(SID):soundPlay(SID,2,"ambient/alarms/klaxon1.wav")
    }
    else{
        SSize = Said[3,string]:toNumber()
    }
    gSetNum(SID+"ssize",SSize)
    holoEntity(SID):removeTrails()
    holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
}
if(C&CMD&Arg=="esize"){
    if(Said[3,string]:toNumber()>120){
        holoEntity(SID):soundPlay(SID,2,"ambient/alarms/klaxon1.wav")
    }
    else{
        ESize = Said[3,string]:toNumber()
    }
    gSetNum(SID+"esize",ESize)
    holoEntity(SID):removeTrails()
    holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
}
if(C&CMD&Arg=="length"){
    if(Said[3,string]:toNumber()>10){
        holoEntity(SID):soundPlay(SID,2,"ambient/alarms/klaxon1.wav")
    }
    else{
        Length = Said[3,string]:toNumber()
    }
    gSetNum(SID+"length",Length)
    holoEntity(SID):removeTrails()
    holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
}
if(C&CMD&Arg=="texture"){
    Texture = Said[3,string]
    gSetStr(SID+"texture",Texture)
    holoEntity(SID):removeTrails()
    holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
}
if(C&CMD&Arg=="col"){
    R = Said[3,string]:toNumber()
    G = Said[4,string]:toNumber()
    B = Said[5,string]:toNumber()
    gSetNum(SID+"r",R)
    gSetNum(SID+"g",G)
    gSetNum(SID+"b",B)
    holoEntity(SID):removeTrails()
    holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
}
if(C&CMD&Arg=="alpha"){
    A = Said[3,string]:toNumber()
    gSetNum(SID+"a",A)
    holoEntity(SID):removeTrails()
    holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
}

if(C&CMD&Arg=="off"){
    holoEntity(SID):removeTrails()
    holoDelete(SID)
}

if(chatClk(owner())&CMD&Arg=="all"){
    hideChat(1)
    findByClass("player")
    Players = findToArray()
    for(I=1,Players:count()){
        Player = Players[I,entity]
        PID = Player:id()
        holoCreate(PID)
        holoPos(PID,Player:pos()+vec(0,0,5))
        holoParent(PID,Player)
        holoScale(PID,vec(0,0,0))
        holoEntity(PID):setTrails(20,0,2,"trails/laser",teamColor(Player:team()),255)
        holoAlpha(PID,0)
    }
}
if(chatClk(owner())&CMD&Arg=="remove"){
    hideChat(1)
    gDeleteAll()
    selfDestruct()
}

#type "$ new" to create a new trai on you
#type "$ length" to change the Length of the trail (0 is minimum, 10 is maximum!)
#type "$ ssize" to change the start size of the trail (0 is minimum, 100 is maximum)
#type "$ esize" to change th End size of the trail (0is minimum, 100 is maximum)
#type "$ off" to remove your trail
#type "$ col R G B" to change the Color off the trail (example: "$ col 255 120 0" for an orange trail)
#type "$ texture texture" to change the texture of the trail (exampe: "$texture pasma" for a trail with the #plasma texture)
#type "$ alpha" to change the alpha of the trail (0 is invisible 255 is complete visible)
#type "$ all" to give everyone on the server a trail (chip owner only!)