@name Bomb Truck
@persist [E I J K M R T Q Z]:number [V S]:entity [B Y H W]:array [C]: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){
        D=V:driver()
        if(D){
            if(D:keyAttack2()){
                J=0
                TempCheck=1
            }
        }
        TK=V:vel():length()
        if(!V:isPlayerHolding()){
            if(TK<K){
                if(K-TK>300){
                    J-=5*sqrt(K-TK)
                    TempCheck=1
                    holoMaterial(20,"models/props_foliage/tree_deciduous_01a_trunk")
                }
            }
        }else{
            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-1,0,100)
                                    TempCheck=1
                                }
                            }
                        }
                    }
                }
            }
        }
        K=TK
    }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()
    if(Chip:isWeldedTo():model()=="models/buggy.mdl"){
        V=Chip:isWeldedTo()
        if(V:isVehicle()){
            if(V:owner()==owner()){
                TempCol=V:getColor()
                if(TempCol:x()==255){
                    TempNumG=TempCol:y()
                    if(TempNumG==TempCol:z()){
                        J=TempNumG/2.55
                        V:setAlpha(0)
                    }else{
                        J=100
                        V:setColor(255,255,255,0)
                    }
                }else{
                    J=100
                    V:setColor(255,255,255,0)
                }
                I=1
                E=30
                Chip:setAlpha(0)
                C=vec(150,125,100)
                P=V:pos()
                A=V:angles()
                A90=A+ang(90,0,0)
                F="models/props_c17/FurnitureMetal001a"
                holoCreate(1,P+vec(0,-70,10):rotate(A),vec(6,17,1),A,C,"cube")
                holoParent(1,V)
                holoMaterial(1,F)
                holoCreate(2,P+vec(-21.6,40,10):rotate(A),vec(4,0.5,2),A+ang(0,20,0),C,"cube")
                holoCreate(3,P+vec(21.6,40,10):rotate(A),vec(4,0.5,2),A-ang(0,20,0),C,"cube")
                holoCreate(4,P+vec(0,14,28):rotate(A),vec(6,3,2),A,C,"cube")
                holoCreate(5,P+vec(33,-88,28):rotate(A),vec(0.5,14,2),A,C,"cube")
                holoCreate(6,P+vec(-33,-88,28):rotate(A),vec(0.5,14,2),A,C,"cube")
                holoCreate(7,P+vec(42,0,15):rotate(A),vec(3,3,1),A90,vec(50,50,50),"hqcylinder2")
                holoCreate(8,P+vec(-42,0,15):rotate(A),vec(3,3,1),A90,vec(50,50,50),"hqcylinder2")
                holoCreate(9,P+vec(42,-152,15):rotate(A),vec(3,3,1),A90,vec(50,50,50),"hqcylinder2")
                holoCreate(10,P+vec(-42,-152,15):rotate(A),vec(3,3,1),A90,vec(50,50,50),"hqcylinder2")
                holoCreate(11,P+vec(42,-112,15):rotate(A),vec(3,3,1),A90,vec(50,50,50),"hqcylinder2")
                holoCreate(12,P+vec(-42,-112,15):rotate(A),vec(3,3,1),A90,vec(50,50,50),"hqcylinder2")
                holoCreate(13,P+vec(33,-8,58):rotate(A),vec(0.5,0.5,4),A+ang(0,0,20),C,"cube")
                holoCreate(14,P+vec(-33,-8,58):rotate(A),vec(0.5,0.5,4),A+ang(0,0,20),C,"cube")
                holoCreate(24,P+vec(0,-8,58):rotate(A),vec(5,0.25,4),A+ang(0,0,20),vec(),"cube")
                holoClip(24,vec(),ang(0,180,0):right(),0)
                holoClipEnabled(24,1)
                holoCreate(16,P+vec(0,-8,58):rotate(A),vec(5,0.25,4),A+ang(0,0,20),vec(),"cube")
                holoClip(16,vec(),ang():right(),0)
                holoClipEnabled(16,1)
                holoAlpha(16,100)
                holoCreate(17,P+vec(0,-37,80):rotate(A),vec(6,4,0.5),A,C,"cube")
                holoCreate(18,P+vec(0,-64,47):rotate(A),vec(6,0.5,6),A,C,"cube")
                holoCreate(25,P+vec(0,-30,47):rotate(A),vec(5.9,5.9,5.9),A,vec(50,50,50),"cube")
                holoClip(25,vec(0,20,11),ang(0,0,20):right(),0)
                holoClipEnabled(25,1)
                holoCreate(20,P+vec(0,-30,47):rotate(A),vec(-5.1,-5.1,-5.1),A,vec(50,50,50),"cube")
                holoAlpha(20,100)
                holoClip(20,vec(0,20,11),ang(0,0,20):right(),0)
                holoClipEnabled(20,1)
                holoCreate(21,P+vec(0,-169,46):rotate(A),vec(6,0.5,5),A,C,"cube")
                holoCreate(22,P+vec(33,-121,58):rotate(A),vec(0.5,7.5,3),A,C,"cube")
                holoCreate(23,P+vec(-33,-121,58):rotate(A),vec(0.5,7.5,3),A,C,"cube")
                holoCreate(15,P+vec(0,-79,46):rotate(A),vec(5,0.5,5),A,C,"cube")
                holoCreate(19,P+vec(0,-124,40):rotate(A),vec(5,7,4),A,C,"cube")
                for(X=2,25){
                    holoMaterial(X,F)
                    holoParent(X,1)
                }
                holoMaterial(24,"models/shiny")
                holoMaterial(25,"models/shiny")
                holoMaterial(19,"models/props_debris/concretefloor020a")
                runOnTick(1)
                runOnLast(1)
                M=holoRemainingSpawns()
                dsJoinGroup("SGCombatSystem")
                dsSetScope(2)
                Q=maxPlayers()
                TempCheck=1
            }else{
                printColor(vec(255,255,255)," -[ ",vec(255,0,0),"You must own that 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()
    }
}elseif(last()){
    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)
            }
        }
        TempC=J*2.55
        V:setColor(255,TempC,TempC)
    }else{
        holoDeleteAll()
        V:killPod()
        V:lockPod(1)
        V:soundPlay("Splosion"+I,0,"^weapons/explode2.wav")
        dsLeaveGroup("SGCombatSystem")
        dsSend("NukeDamage","SGCombatSystem",2,V:pos())
        T=0
        for(X=1,2){
            holoCreate(X,V:pos(),vec(),ang(),vec(255,255,255),"hqicosphere2")
            holoMaterial(X,"models/effects/splode_sheet")
        }
    }
}

