daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. AddCSLuaFile( "cl_init.lua" )
  3. AddCSLuaFile( "shared.lua" )
  4.  
  5. include('shared.lua')
  6.  
  7. function ENT:Initialize()  
  8.  
  9. math.randomseed(CurTime())
  10. self.exploded = false
  11. self.armed = true
  12. self.ticking = true
  13. self.smoking = false
  14. self.flightvector = self.Entity:GetUp() * 100
  15. self.Entity:SetModel( "models/combatmodels/tankshell.mdl" )    
  16. self.Entity:PhysicsInit( SOLID_VPHYSICS )      
  17. self.Entity:SetMoveType( MOVETYPE_NONE )       
  18. self.Entity:SetSolid( SOLID_VPHYSICS )                  
  19.  
  20. self:Think()
  21.  
  22. end  
  23.  
  24.  function ENT:Think()
  25.     if (self.smoking == false) then
  26.         self.smoking = true
  27.    
  28.         FireTrail = ents.Create("env_fire_trail")
  29.         FireTrail:SetKeyValue("spawnrate","3")
  30.         FireTrail:SetKeyValue("firesprite","sprites/firetrail.spr" )
  31.         FireTrail:SetPos(self.Entity:GetPos())
  32.         FireTrail:SetParent(self.Entity)
  33.         FireTrail:Spawn()
  34.         FireTrail:Activate()
  35.     end
  36.  
  37.  
  38.     local trace = {}
  39.         trace.start = self.Entity:GetPos()
  40.         trace.endpos = self.Entity:GetPos() + self.flightvector *3
  41.         trace.filter = self.Entity
  42.     local tr = util.TraceLine( trace )
  43.    
  44.     if (tr.Hit) then
  45.         if ( self.exploded == false ) then
  46.             if ( self.exploded == false && self.ticking == true ) then
  47.                 util.BlastDamage(self.Entity, self.Entity, self.Entity:GetPos(), 100, 50)
  48.                 if (tr.Entity:IsWorld() || tr.Entity:IsPlayer() || tr.Entity:IsNPC()) then
  49.                     local effectdata = EffectData()
  50.                     effectdata:SetOrigin(self.Entity:GetPos())
  51.                     effectdata:SetStart(self.Entity:GetPos())
  52.                     util.Effect( "Explosion", effectdata )
  53.                     self.exploded = true
  54.                     self.Entity:Remove()
  55.                     return true
  56.                 end
  57.  
  58.    
  59.                 local attack = cbt_dealhcghit( tr.Entity, 1000, 7, tr.HitPos , tr.HitPos)
  60.                 if (attack == 0) then
  61.                     brokedshell = ents.Create("prop_physics")
  62.                     brokedshell:SetPos(self.Entity:GetPos())
  63.                     brokedshell:SetAngles(self.Entity:GetAngles())
  64.                     brokedshell:SetKeyValue( "model", "models/combatmodels/tankshell.mdl" )
  65.                     brokedshell:PhysicsInit( SOLID_VPHYSICS )
  66.                     brokedshell:SetMoveType( MOVETYPE_VPHYSICS )
  67.                     brokedshell:SetSolid( SOLID_VPHYSICS )
  68.                     brokedshell:Activate()
  69.                     brokedshell:Spawn()
  70.                     brokedshell:Fire("Kill", "", 20)
  71.                     local phys = brokedshell:GetPhysicsObject()    
  72.                     if (phys:IsValid()) then  
  73.                         phys:SetVelocity(self.flightvector * 10000)
  74.                     end
  75.                 end
  76.  
  77.  
  78.  
  79.                 self.exploded = true
  80.                 self.Entity:Remove()
  81.             end
  82.         end
  83.     end
  84.  
  85.     self.Entity:SetPos(self.Entity:GetPos() + self.flightvector)
  86.     self.flightvector = self.flightvector + Vector(0,0,-1)
  87.     self.Entity:SetAngles(self.flightvector:Angle() + Angle(90,0,0))
  88.     self.Entity:NextThink( CurTime() )
  89.     return true
  90. end
RAW Paste Data
Top