@name Nano-swarm Server
@inputs 
@outputs 
@persist Swarm:table Com Break Dog:entity SpawnCount
runOnTick(1)
runOnChat(1)
if(first()) 
{
    timer("Start", 10)
    SpawnCount = 0
}

if(clk("Start"))
{
    if(SpawnCount < 4)
    {
        Swarm[SpawnCount:toString(),entity] = propSpawn("models/hunter/plates/plate.mdl", 0)
        Swarm[SpawnCount:toString(),entity]:propGravity(0)
        Swarm[SpawnCount:toString(),entity]:setMass(50)
        Swarm[SpawnCount:toString(),entity]:setMaterial("phoenix_storms/stripes")
        #Swarm[SpawnCount:toString(),entity]:setTrails(200,100,200,"phoenix_storms/stripes",vec(255,255,255),255)
        Swarm[SpawnCount:toString(),entity]:ignite()
        #Swarm[SpawnCount:toString(),entity]:setNoCollideAll()
        SpawnCount += 1
        timer("Start", 250)
    }
    else
    {
        stoptimer("Start")
    }
}

Chat = owner():lastSaid()
Com = Chat:find("Swarm")
Break = Chat:find("|")
if(Com & chatClk(owner()))
{
    ChatArr = Chat:explode("|")
    Dog = findPlayerByName(ChatArr[2,string])
}




if(Dog:isValid())
{
    foreach(K, V:entity=Swarm)
    {
        V:teleport(Dog:shootPos())
    }
}
