@name FailCake Module Bd3 - OpGun St3
@persist [Mode Props Plys]:array [O E Prop Ply Wep]:entity MD T Wait K Gg Ang:angle Weapon:string
@trigger all

if(first() | duped()){
propSpawnEffect(0)
runOnTick(1)

O = owner()
E = entity()
MD = 1

Mode:pushString("FreezeGun")
Mode:pushString("StripGun")   
}


if(O:weapon():type() == "weapon_physgun"){
    
if(changed(O:keyReload()) & O:keyReload()){

if(MD < Mode:count()){
MD+=1   
}else{
MD = 1
}
    
hint("* Mode Changed : " + Mode[MD,string] + " *",7)
}

    

if(changed(O:keyAttack2()) & O:keyAttack2()){
    
    
    
if(MD == 1 & Wait != 1 & Gg == 0){
if(O:aimEntity():isPlayer()){
if(O:pos():distance(O:aimEntity():pos()) < 700){    
if(T < 3){
Ply = O:aimEntity()
Plys:pushEntity(Ply)

Gg = 1

T+=1
timer("flife_"+T,10000)

holoCreate(T)
holoModel(T,"cube")
holoPos(T,Ply:toWorld(vec(0,0,40)))
holoAlpha(T,0)
holoScaleUnits(T,vec(0.5,0.5,0.5))
holoParent(T,Ply)

holoCreate(T+5)
holoModel(T+5,"models/props_wasteland/rockgranite03b.mdl")
holoPos(T+5,Ply:toWorld(vec(0,0,40)))
holoAlpha(T+5,255)
holoMaterial(T+5,"models/props_combine/health_charger_glass")
holoScale(T+5,vec(3,3,3))
holoParent(T+5,Ply)

holoEntity(T):soundPlay(T,1,"physics/glass/glass_strain"+randint(1,2)+".wav")

Prop = propSpawn("models/hunter/blocks/cube05x05x025.mdl",Ply:toWorld(vec(0,0,40)),ang(0,0,0),1)
Prop:setAlpha(0)
Props:pushEntity(Prop)    
}else{
Wait = 1
}
}
}   
}



  
}
}



if(Gg){


}



## Delete Props..freeze..
if(Props:count() > 0){
for(I = 1,T){
Props[I,entity]:setPos(Plys[I,entity]:toWorld(vec(0,0,40)))

if(clk("flife_"+I) || !Plys[I,entity]:isAlive()){ 
Props[I,entity]:propDelete() 
holoEntity(I):soundPlay(I,1,"physics/glass/glass_largesheet_break"+randint(1,3)+".wav")
holoDelete(I)
holoDelete(I+5)
K+=1
}
   
}
}

if(K >= 3){
K = 0
T = 0
Wait = 0
Plys:clear()
Props:clear()  
}
