@name Virulent Deathmatch
@persist R:array Stg T U A I Cmd Fl Fl2 Fl3 Fl4 Fl5 Fl6 Fl7 Fl8 C Cnt Smp Win Reload Inf [Host Null]:entity 
runOnTick(1)
O=owner()
T=clamp(T,0,50)
U=clamp(U,-50,0)
timer("click",100)


if(first())
{
    Null=noentity()
    Inf=0
    Win=0
    C=100
    Fl2=1
    Fl3=1
    Fl4=1
    Fl5=1
    Fl6=1
    Fl7=1
    Fl8=1
    Stg=0    
    hint("Vous etes ZeroEdge",5)
    hint("Virus Gun Activated",5)
    hint("Pistol Converted",5)
    
}
if(O:keyAttack1()&O:weapon():model()=="models/weapons/v_pistol.mdl"&Stg==0)
{
    holoCreate(-1) 
    holoModel(-1,"hqsphere")
    holoScale(-1,vec(0,0,0))
    holoCreate(-2) 
    holoModel(-2,"hqsphere")
    holoScale(-2,vec(0,0,0))
    Stg=1
}
if(!O:keyAttack1()&Stg==1)
{
    holoPos(-1,O:aimPos())
    holoPos(-2,holoEntity(-1):pos())
    O:soundPlay(2,0,"weapons/Irifle/irifle_fire2.wav")
    holoEntity(-1):soundPlay(1,0,"weapons/mortar/mortar_explode3.wav")
    Stg=2
}
if(Stg==2)
{
    if(clk("click"))
    {
        T+=3
        U-=3
        C+=1
        C=clamp(C,0,255)
    }
    holoScale(-1,vec(T,T,T))
    holoColor(-1,vec(255-C,C,0))
    holoScale(-2,vec(U,U,U))
    holoColor(-2,vec(255-C,C,0))
    findByClass("player")
    R=findToArray()
    for(I=1,R:count()) 
    {
        if(holoEntity(-1):pos():distance(R[I,entity]:pos())<T*6.5)
        {
        holoCreate(I)
        holoParent(I,R[I,entity])
        Cmd+=1
        Cmd=clamp(Cmd,0,R:count())
        if(Cmd!=0&!Fl)
        {       
            concmd("say DeathMatch Mod: Des joueurs on etes infectes")
            Inf=1
        }
        if(Cmd>=R:count())
        {
          Fl=1
           if(Fl)
            {
                Cmd=0
                Host=R[randint(1,I),entity]
                
            }
        }
    }
        
        holoPos(I,R[I,entity]:pos()+vec(0,0,50))
        holoScaleUnits(I,R[I,entity]:boxSize()*-1)
        holoAng(I,R[I,entity]:angles())
        holoColor(I,vec(0,155,0),150)
        
    }
}

if(T>=50)
{
    if(Inf==0)
    {
        Reload=1
    }
    if(Fl8!=0)
{
    if(Host==Null)
    {
        concmd("say DeathMatch Mod: Personne n'est infecte sur ce tir")
    }
    else
    {
        concmd("say Le MasterMind est "+Host:name()+" TUEZ CET ENCULER !!")
        Fl8=0
    }
}
    Stg=3
}

if(Stg==3)
{
    if(!Cmd&Reload)
    {
        concmd("say DeathMatch Mod: Personne n'est infecte, chargement")
        Stg=0
        T=0
        U=0
        C=100
        Reload=0
        Fl8=1
        holoDelete(-1)
        holoDelete(-2)
    }
    A=clamp(A,0,254)
    A++
    holoAlpha(-1,255-A)   
    holoAlpha(-2,255-A)
    if(Fl6!=0)
    {
        concmd("say Quand le compte a rebourd a commence, tuez le MasterMind pour vous desintoxiquer")
        Fl6=0
    }
}

if(A>=255&Stg==3)
{
    
    if(Fl2!=0)
    {
        concmd("say 3 minutes")
        Fl2=0
    }
    if(!Host:isAlive())
    {
        concmd("say Le MasterMind est mort, vous gagnez !")
        Win=1
    }
    Stg=4
    holoDelete(-1)
    holoDelete(-2)
}

if(Stg==4)
{
    timer("countdown",1000)
    if(clk("countdown"))
    {
        Cnt++
        Cnt=clamp(Cnt,0,240)
    }
    if(Cnt==120&Fl3!=0)
    {
        concmd("say Symptoms sort")
        
        Fl3=0
    }    
    
}
if(Cnt>=120)
{
    if(clk("countdown"))
    {
        Smp+=2
        Smp=clamp(Smp,0,105)
    }
    for(I=1,R:count()) 
    {
        holoAlpha(I,150+Smp)
    }
    if(Cnt==180&Fl4!=0&!Win)
    {
        concmd("say 1 minute avant que vous perdez")
        Fl4=0
    }
    if(Cnt==240&Fl7!=0&!Win)
    {
        concmd("say Game Over, t'as perdu !")
        Fl7=0
    }
    
}

if(Win)
{
    if(Fl5!=0)
    {
        concmd("say Congratulations you Win!")
        Fl5=1
    }
    if(Fl5)
    {
        selfDestruct()
    }
}
#Lose
if(!Win&!Fl7)
{
    selfDestruct()
}
