@name 
@outputs A:array Once Flash B:array Start
@persist Player:entity Timer Click Pla Alpha Start
@trigger all
@model models/Items/grenadeAmmo.mdl

interval(1)
E = entity()
E:setText("Push E on me and see what happens :D")
E:setMass(5)
E:setColor(255,255,255)
if(first()){
  

    Alpha = 999999999
    E:removeTrails()
    findByClass("player")
    A=findToArray()
}

for(I=1,A:count()){
    Player = A[I,entity]
    if(Player:keyUse() & Player:aimEntity()==entity() & Once==0){
hint("Activated",100)
Once = 1
}
}

if(Once){
Timer += 0.2
Click += 0.5
if(Timer == 1){
E:soundPlay(4000,4000,"weapons/pinpull.wav")
E:setTrails(10,10,90,"trails/laser",vec(255,255,255),200)
}
if(Click == 3){
E:soundPlay(1000,1000,"weapons/grenade/tick1.wav")
}

if(Click >= 4){
soundStop(1000)
Click = 0
}
if(Timer == 20){
E:soundPlay(2000,2000,"weapons/flashbang/flashbang_explode1.wav")   
E:soundPlay(3000,3000,"weapons/flashbang/flashbang_explode2.wav")   
}
if(Timer >= 20){
soundStop(1000)
Flash = 1
}
}


if(Flash){
E:setAlpha(255)
holoCreate(1)
holoModel(1,"icosphere3")
holoAlpha(1,0)
holoPos(1,E:pos()+vec(0,0,0))
holoScale(1,vec(-50,-50,-50))
holoParent(1,E)
EE=holoEntity(1)

for(I=0,A:count()){
    Player = A[I,entity]
    
    if(
        (Player:pos():distance(EE:pos())<600)
    ){

Start = 1
}
}
}


if(Start){
    

for(I=1,A:count()){
    Player = A[I,entity]

    
    if(Player:pos():distance(EE:pos())<600)
    {
    if(Alpha > 0) {Alpha-=1}
    if(Alpha <= 0){selfDestructAll()}
    holoCreate(I+1)
    holoParentAttachment(I+1,Player,"anim_attachment_head")
    holoModel(I+1,"hqicosphere")
    holoPos(I+1,Player:pos()+vec(0,0,50))
    holoScale(I+1,vec(-5,-5,-5))
    holoColor(I+1,vec(111,111,242))
    holoAlpha(I+1,Alpha)
    
    }
                   Start = 0 }
}

if(duped()){selfDestructAll()}
if(duped()){selfDestructAll()}
