Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. function SWEP:ShootBullet(damage, recoil, num_bullets, aimcone)
  2.  
  3. num_bullets = num_bullets or 1
  4. aimcone = aimcone or 0
  5.  
  6. self:ShootEffects()
  7.  
  8. if self.Tracer == 1 then
  9. TracerName = "Ar2Tracer"
  10. elseif self.Tracer == 2 then
  11. TracerName = "AirboatGunHeavyTracer"
  12. else
  13. TracerName = "Tracer"
  14. end
  15.  
  16. local bullet = {}
  17. bullet.Num = num_bullets
  18. bullet.Src = self.Owner:GetShootPos() -- Source
  19. bullet.Dir = self.Owner:GetAimVector() -- Dir of bullet
  20. bullet.Spread = Vector(aimcone, aimcone, 0) -- Aim Cone
  21. bullet.Tracer = 3 -- Show a tracer on every x bullets
  22. bullet.TracerName = TracerName
  23. bullet.Force = damage * 0.25 -- Amount of force to give to phys objects
  24. bullet.Damage = damage
  25. bullet.Callback = function(attacker, tracedata, dmginfo)
  26. if tracedata:IsPlayer() and math.random(1,10) < 2 then
  27. tracedata:Ignite(2)
  28. end
  29.  
  30. return self:RicochetCallback(0, attacker, tracedata, dmginfo)
  31. end
  32.  
  33. self.Owner:FireBullets(bullet)
  34. -- if SERVER and !self.Owner:IsNPC() then
  35. -- local anglo = Angle(math.Rand(-self.Primary.KickDown,-self.Primary.KickUp), math.Rand(-self.Primary.KickHorizontal,self.Primary.KickHorizontal), 0)
  36. -- self.Owner:ViewPunch(anglo)
  37.  
  38. -- local eyes = self.Owner:EyeAngles()
  39. -- eyes.pitch = eyes.pitch + anglo.pitch
  40. -- eyes.yaw = eyes.yaw + anglo.yaw
  41. -- if game.SinglePlayer() then self.Owner:SetEyeAngles(eyes) end
  42. -- end
  43.  
  44. local anglo1 = Angle(math.Rand(-self.Primary.KickDown,-self.Primary.KickUp), math.Rand(-self.Primary.KickHorizontal,self.Primary.KickHorizontal), 0)
  45. self.Owner:ViewPunch(anglo1)
  46.  
  47. if SERVER and game.SinglePlayer() and !self.Owner:IsNPC() then
  48. local offlineeyes = self.Owner:EyeAngles()
  49. offlineeyes.pitch = offlineeyes.pitch + anglo1.pitch
  50. offlineeyes.yaw = offlineeyes.yaw + anglo1.yaw
  51. if GetConVar("M9KDynamicRecoil"):GetBool() then
  52. self.Owner:SetEyeAngles(offlineeyes)
  53. end
  54. end
  55.  
  56. if CLIENT and !game.SinglePlayer() and !self.Owner:IsNPC() then
  57. local anglo = Angle(math.Rand(-self.Primary.KickDown,-self.Primary.KickUp), math.Rand(-self.Primary.KickHorizontal,self.Primary.KickHorizontal), 0)
  58.  
  59. local eyes = self.Owner:EyeAngles()
  60. eyes.pitch = eyes.pitch + (anglo.pitch/3)
  61. eyes.yaw = eyes.yaw + (anglo.yaw/3)
  62. if GetConVar("M9KDynamicRecoil"):GetBool() then
  63. self.Owner:SetEyeAngles(eyes)
  64. end
  65. end
  66.  
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement