Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. function SWEP:PrimaryAttack()
  2.    
  3.     if ( !self:CanPrimaryAttack() ) then return end
  4.     self:EmitSound("ambient/energy/zap3.wav", 75, 80, 1, CHAN_WEAPON )
  5.     self.Owner:SetAnimation( PLAYER_ATTACK1 )
  6.     self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
  7.    
  8.     local bullet = {}
  9.         bullet.Num = 1
  10.         bullet.Src = self.Owner:GetShootPos()
  11.         bullet.Dir = self.Owner:GetAimVector()
  12.         bullet.Tracer = 0
  13.         bullet.Force = self.Primary.Force
  14.         bullet.Damage = 0
  15.         bullet.AmmoType = self.Primary.Ammo
  16.         bullet.Distance = 80
  17.    
  18.    
  19.     local tr = util.TraceLine( {
  20.         start = self.Owner:GetShootPos(),
  21.         endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * 999999999999999999999999999,
  22.         filter = self.Owner,
  23.         ignoreworld = true,
  24.     } )
  25.     a =Vector(self.Owner:GetShootPos())
  26.     b =Vector(self.Owner:GetShootPos() + self.Owner:GetAimVector())
  27.     local pt = util.ParticleTracerEx( "env_fire_random_puff", a, b, true, self.Owner:EntIndex(), 1 )
  28.    
  29.     pp = self.Owner
  30.     ent = tr.Entity
  31.     local dmginfo = DamageInfo()
  32.     dmginfo:SetAttacker( pp )
  33.     dmginfo:SetDamage( 2 )
  34.     dmginfo:SetInflictor( self )
  35.     dmginfo:SetDamageType( 67108864 )
  36.    
  37.     if ( SERVER && IsValid( tr.Entity ) && ( tr.Entity:IsNPC() || tr.Entity:IsPlayer() || tr.Entity:Health() > 0 ) ) then
  38.         tr.Entity:TakeDamageInfo( dmginfo )
  39.         tr.Entity:Ignite( 2, 0 )
  40.         self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
  41.     end
  42.    
  43.     self.Owner:FireBullets( bullet )
  44.     self:TakePrimaryAmmo(self.Primary.TakeAmmo)
  45.    
  46.    
  47.     self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
  48.     self:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
  49.    
  50.    
  51.    
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement