@name Nuke Cannon!
@persist [A U]:angle [Atk2 Deployed E I J M N O R T Q Z]:number [V S]:entity [B Y H W Hit]:array [C Gravity]:vector
if(dsClk()){
    if(dsClk("DroneDamage")){
        if(dsGetEntity()==V){
            V:applyOffsetForce(vec(0,0,1)*V:mass()*150,V:pos()  +V:right()*(random()>0.5 ? 10 : -10))
            TempCheck=1
            J-=randint(5,10)
        }
    }
    if(dsClk("TankDamage")){
        TempVec=dsGetVector()
        TempD=V:pos():distance(TempVec)
        if(TempD<300){
            V:applyOffsetForce(V:mass()*(V:pos()-TempVec)*(300-TempD)*0.01,TempVec)
            TempCheck=1
            J-=floor((300-TempD)/6)
        }
    }
    if(dsClk("NukeDamage")){
        TempVec=dsGetVector()
        TempD=V:pos():distance(TempVec)
        if(TempD<1000){
            V:applyOffsetForce(V:mass()*(V:pos()-TempVec)*(1000-TempD)*0.01,TempVec)
            TempCheck=1
            J-=ceil((1000-TempD)*0.2)
        }
    }
}elseif(tickClk()){
    if(J>0){
        T--
        R--
        if(T>0){
            TempNum=T*1.8
            holoScale(24,vec(1.7,1.7,5.5-sin(TempNum*2)*2))
            holoAlpha(25,255-cos(TempNum)*255)
            holoScale(25,vec(1.5,cos(TempNum)*10,1.5))
        }else{
            holoScale(24,vec(1.7,1.7,5.5))
            holoAlpha(25,0)
            holoScale(25,vec(1.5,3,1.5))
        }
        D=V:driver()
        A=V:angles()
        if(D){
            if(Atk2){
                if(!D:keyAttack2()){
                    Atk2=0
                }
            }elseif(D:keyAttack2()){
                Atk2=1
                Deployed=!Deployed
            }
            if(Z){
                if(!D:keyAttack1()){
                    Z=0
                }
            }elseif(D:keyAttack1()){
                Z=1
                if(Deployed){
                    if(R<=0){
                        T=50
                        R=150
                        G=S:pos()
                        TempHolo=holoCreate(-I,G,vec(1,1,1),ang(),vec(10,10,10),"hqicosphere2")
                        TempVec=S:right()*E
                        Y[I,vector]=-TempVec
                        V:applyOffsetForce(TempVec*V:mass(),G)
                        H[I,number]=100
                        Hit[I,number]=1
                        W[I,number]=0
                        TempHolo:setTrails(10,0,1,"trails/smoke",vec(),255)
                        B[I,entity]=TempHolo
                        holoMaterial(-I,"models/models_pipes/GutterMetal01a")
                        S:soundPlay("Shooting"+I,0,"^weapons/explode4.wav")
                        I++
                        if(I>M){
                            I=1
                        }
                    }
                }
            }
        }else{
            Deployed=0
            T=0
            for(X=1,Q){
                TempP=entity(Q)
                if(TempP){
                    if(TempP:weapon():type()=="weapon_crowbar"){
                        if(TempP:keyAttack1()){
                            if(TempP:aimEntity()==V){
                                if(TempP:shootPos():distance(TempP:aimPos())<=75){
                                    J=clamp(J+0.05,0,100)
                                    TempCheck=1
                                }
                            }
                        }
                    }
                }
            }
        }
        if(Deployed){
            U=D:eyeAngles()-A
        }else{
            U=ang(60,90,0)
        }
        TempNum=U:yaw()-O
        if(TempNum>1){
            if(TempNum>180){
                O+=360
                O--
            }else{
                O++
            }
        }elseif(TempNum<-1){
            if(TempNum<-180){
                O-=360
                O++
            }else{
                O--
            }
        }else{
            O=U:yaw()
        }
        TempNum=U:pitch()-N
        if(TempNum>1){
            N++
        }elseif(TempNum<-1){
            N--
        }else{
            N=U:pitch()
        }
        TempNum=A:yaw()+O
        holoAng(17,ang(-A:roll(),TempNum,A:pitch()))
        holoAng(22,ang(A:pitch(),TempNum-90,A:roll()+20-N/3))
        for(X=1,M){
            TempNum=W[X,number]
            if(TempNum){
                if(TempNum>150){
                    holoClipEnabled(-X,0)
                    holoDelete(-X)
                    B[X,entity]:setTrails(10,0,1,"trails/smoke",vec(),0)
                    W[X,number]=0
                }else{
                    TempNum=TempNum+1
                    TempNum2=sin(TempNum*0.6)*50
                    TempNum3=cos(TempNum*0.6)
                    holoScale(-X,vec(TempNum2,TempNum2,TempNum2))
                    holoAlpha(-X,TempNum3*255)
                    holoAng(-X,ang(TempNum*6,TempNum2*10,TempNum3*50))
                    W[X,number]=TempNum
                }
            }elseif(Hit[X,number]){
                TempPos=B[X,entity]:pos()
                TempVec=(Y[X,vector]-Gravity)*0.999
                TempR=rangerOffset(TempPos,TempPos+TempVec)
                if(TempR:hit()&TempR:entity()!=V){
                    Hit[X,number]=0
                    holoClip(-X,TempR:position(),TempR:hitNormal(),1)
                    holoClipEnabled(-X,1)
                    holoMaterial(-X,"models/effects/splode_sheet")
                    holoColor(-X,vec(255,255,255))
                    TempHoloEnt=B[X,entity]
                    dsSend("NukeDamage","SGCombatSystem",2,TempR:position())
                    TempHoloEnt:soundPlay("Splosion"+I,0,"^weapons/explode2.wav")
                    soundVolume("Splosion"+I,10)
                    W[X,number]=1
                }else{
                    holoPos(-X,TempPos+TempVec)
                    Y[X,vector]=TempVec
                }
            }
        }
    }else{
        T++
        Temp=sin(T)
        TempC=cos(T)*255
        TempV=vec(14,14,14)+vec(Temp,Temp,Temp)*36
        TempA=ang(Temp*50,TempC*30,T*80)
        holoScale(1,TempV)
        holoScale(2,-TempV)
        holoAlpha(1,TempC)
        holoAlpha(2,TempC)
        holoAng(1,TempA)
        holoAng(2,-TempA)
        if(T>=90){
            selfDestructAll()
        }
    }
}elseif(first()){
    Chip=entity()
    V=Chip:isWeldedTo()
    if(V:model()=="models/buggy.mdl"){
        if(V:isVehicle()){
            if(V:owner()==owner()){
                J=100
                I=1
                E=100
                Gravity=vec(0,0,1)
                Chip:setAlpha(0)
                V:setAlpha(0)
                runOnTick(1)
                runOnLast(1)
                C=vec(125,150,50)
                White=vec(255,255,255)
                Black=vec()
                A=V:angles()
                P=V:pos()
                F=ang(45,90,0):forward()
                TempVec=P+vec(0,-30,45):rotate(A)
                holoCreate(1,TempVec,vec(5.9,5.8,4.7),A,Black,"cube")
                holoParent(1,V)
                holoMaterial(1,"models/shiny")
                holoCreate(2,TempVec,-vec(5.1,5.1,4.75),A,White,"cube")
                holoParent(2,1)
                holoMaterial(2,"models/shiny")
                holoAlpha(2,50)
                holoCreate(3,P+vec(0,-30,18):rotate(A),vec(6,6,1),A,C,"cube")
                holoCreate(4,P+vec(0,3,36):rotate(A),vec(5,0.5,2),  A,C,"cube")
                TempSize=vec(0.5,5,2)
                holoCreate(5,P+vec(33,-30,36):rotate(A),TempSize,A,C,"cube")
                holoCreate(6,P+vec(-33,-30,36):rotate(A),TempSize,A,C,"cube")
                TempSize=vec(0.5,0.5,4)
                holoCreate(7,P+vec(33,3,48):rotate(A),TempSize,A,C  ,"cube")
                holoCreate(8,P+vec(-33,3,48):rotate(A),TempSize,A,C,"cube")
                holoCreate(9,P+vec(0,-63,48):rotate(A),vec(6,0.5,4),A,C,"cube")
                holoCreate(10,P+vec(0,-30,75):rotate(A),vec(6,6,0.5),A,C,"cube")
                holoCreate(11,P+vec(0,-156,12):rotate(A),vec(6,15,2),A,C,"cube")
                holoCreate(12,P+vec(0,-240,36):rotate(A),vec(6,1,2),A,C,"cube")
                TempSize=vec(1,5,2)
                holoCreate(13,P+vec(42,-75,12):rotate(A),TempSize,A,C,"cube")
                holoCreate(14,P+vec(-42,-75,12):rotate(A),TempSize,A,C,"cube")
                holoCreate(15,P+vec(42,-175,12):rotate(A),TempSize,A,C,"cube")
                holoCreate(16,P+vec(-42,-175,12):rotate(A),TempSize,A,C,"cube")
                holoCreate(17,P+vec(0,-156,27):rotate(A),vec(12,6,0.5),A+ang(0,90,0),C,"cube")
                TempSize=vec(1.5,3,3)
                holoCreate(18,P+vec(27,-102,48):rotate(A),TempSize,A,C,"cube")
                holoCreate(19,P+vec(-27,-102,48):rotate(A),TempSize,A,C,"cube")
                holoCreate(20,P+vec(27,-210,48):rotate(A),TempSize,A,C,"cube")
                holoCreate(21,P+vec(-27,-210,48):rotate(A),TempSize,A,C,"cube")
                holoCreate(22,P+vec(0,-200,55):rotate(A),vec(3,4,2),A,C,"cube")
                TempAng=A+ang(0,0,90)
                holoCreate(23,P+vec(0,-152,55):rotate(A),vec(2,2,4),TempAng,C,"hqcylinder2")
                holoCreate(24,P+vec(0,-118,55):rotate(A),vec(1.7,1.7,5.5),TempAng,C,"hqcylinder2")
                S=holoCreate(25,P+vec(0,-85,55):rotate(A),vec(1.5,1.5,1.5),A,C,"hqicosphere2")
                for(X=3,12){
                    holoParent(X,1)
                    holoMaterial(X,"models/props_c17/furnituremetal001a")
                }
                for(X=13,16){
                    holoParent(X,1)
                    holoMaterial(X,"models/props_foliage/tree_deciduous_01a_trunk")
                }
                holoParent(17,1)
                holoMaterial(17,"models/props_c17/furnituremetal001a")
                for(X=18,22){
                    holoParent(X,17)
                    holoMaterial(X,"models/props_c17/furnituremetal001a")
                }
                for(X=23,25){
                    holoParent(X,22)
                    holoMaterial(X,"models/props_c17/furnituremetal001a")
                }
                holoMaterial(25,"models/props_foliage/tree_deciduous_01a_trunk")
                M=clamp(holoRemainingSpawns(),0,10)
                dsJoinGroup("SGCombatSystem")
                dsSetScope(2)
                Q=maxPlayers()
                U=A
                O=90
            }else{
                printColor(vec(255,255,255)," -[ ",vec(255,0,0),"You must own the jeep",vec(255,255,255)," ]-")
                selfDestruct()
            }
        }else{
            printColor(vec(255,255,255)," -[ ",vec(255,0,0),"Spawn the jeep from 'Vehicles' not 'Props'",vec(255,255,255)," ]-")
            selfDestruct()
        }
    }else{
        printColor(vec(255,255,255)," -[ ",vec(255,0,0),"Requires a jeep",vec(255,255,255)," ]-")
        selfDestruct()
    }
}else{
    holoDeleteAll()
    V:setAlpha(255)
}
if(TempCheck){
    TempCheck=0
    if(J>0){
        TempC=sin(J*0.9)
        for(X=1,23){
            if(X<7|X>12){
                holoColor(X,C*TempC)
            }
        }
    }else{
        TempC=J*2.55
        V:setColor(255,TempC,TempC)
        holoDeleteAll()
        V:killPod()
        V:lockPod(1)
        V:soundPlay("Splosion"+I,0,"^weapons/explode2.wav")
        dsLeaveGroup("SGCombatSystem")
        T=0
        for(X=1,2){
            holoCreate(X,V:pos(),vec(),ang(),vec(255,255,255),"hqicosphere2")
            holoMaterial(X,"models/effects/splode_sheet")
        }
    }
}