Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. if SERVER then
  2. AddCSLuaFile( "shared.lua" )
  3. end
  4.  
  5. SWEP.HoldType = "ar2"
  6.  
  7. if CLIENT then
  8. SWEP.PrintName = " Boomstick "
  9. SWEP.Author = "TTT"
  10. SWEP.Slot = 6
  11.  
  12. SWEP.Icon = "VGUI/ttt/icon_ump"
  13.  
  14. SWEP.ViewModelFOV = 72
  15.  
  16. SWEP.EquipMenuData = {
  17. type = "Weapon",
  18. desc = "Shocking shottgun"
  19. };
  20. end
  21.  
  22.  
  23. SWEP.Base = "weapon_tttbase"
  24.  
  25. SWEP.Kind = WEAPON_EQUIP
  26. SWEP.CanBuy = {ROLE_DETECTIVE}
  27. SWEP.LimitedStock = True
  28.  
  29. SWEP.Primary.Damage = 30
  30. SWEP.Primary.NumShots = 8
  31. SWEP.Primary.Delay = .07
  32. SWEP.Primary.Cone = 0.02
  33. SWEP.Primary.ClipSize = 5
  34. SWEP.Primary.ClipMax = 10
  35. SWEP.Primary.DefaultClip = 5
  36. SWEP.Primary.Automatic = true
  37. SWEP.Primary.Ammo = "buckshot"
  38. SWEP.AutoSpawnable = false
  39. SWEP.AmmoEnt = "item_ammo_buckshot_ttt"
  40. SWEP.Primary.Recoil = 3
  41. SWEP.Primary.Sound = Sound( "Weapon_M3.Single" )
  42. SWEP.ViewModel = "models/weapons/v_shot_m3super90.mdl"
  43. SWEP.WorldModel = "models/weapons/w_shot_m3super90.mdl"
  44.  
  45. SWEP.HeadshotMultiplier = 4.5 -- brain fizz
  46.  
  47. SWEP.IronSightsPos = Vector( 5.7, -3, 3 )
  48. SWEP.IronSightsAng = Vector( -1.5, 0.35, 2 )
  49.  
  50. --SWEP.DeploySpeed = 3
  51.  
  52. function SWEP:ShootBullet( dmg, recoil, numbul, cone )
  53. local sights = self:GetIronsights()
  54.  
  55. function SWEP:FirePulse(force_bwd, force_lft)
  56. if not IsValid(self.Owner) then return end
  57.  
  58.  
  59. numbul = numbul or 1
  60. cone = cone or 0.01
  61.  
  62. -- 10% accuracy bonus when sighting
  63. cone = sights and (cone * 0.9) or cone
  64.  
  65. local bullet = {}
  66. bullet.Num = numbul
  67. bullet.Src = self.Owner:GetShootPos()
  68. bullet.Dir = self.Owner:GetAimVector()
  69. bullet.Spread = Vector( cone, cone, 0 )
  70. bullet.Tracer = 5
  71. bullet.Force = force_lft / 6
  72. bullet.Damage = dmg
  73.  
  74. local owner = self.Owner
  75. local lft = force_lft / num
  76. local bwd = force_bwd / num
  77. bullet.Callback = function(att, tr, dmginfo)
  78. LocalPlayer():IsActiveDetective() = tr.Entity
  79. if SERVER and IsValid(ply) and ply:IsPlayer() and (not ply:IsFrozen()) then
  80.  
  81. ply:SetGroundEntity(nil)
  82. ply:SetLocalVelocity(ply:GetVelocity())
  83.  
  84. ply.was_pushed = {att=owner, t=CurTime()}
  85.  
  86. end
  87. end
  88.  
  89. if SERVER or (CLIENT and IsFirstTimePredicted()) then
  90. local ent = tr.Entity
  91. if (not tr.HitWorld) and IsValid(ent) then
  92. local edata = EffectData()
  93.  
  94. edata:SetEntity(ent)
  95. edata:SetMagnitude(4)
  96. edata:SetScale(3)
  97.  
  98. util.Effect("TeslaHitBoxes", edata)
  99.  
  100. if SERVER and ent:IsPlayer() then
  101. local eyeang = ent:EyeAngles()
  102.  
  103. local j = 10
  104. eyeang.pitch = math.Clamp(eyeang.pitch + math.Rand(-j, j), -90, 90)
  105. eyeang.yaw = math.Clamp(eyeang.yaw + math.Rand(-j, j), -90, 90)
  106. ent:SetEyeAngles(eyeang)
  107. end
  108. end
  109. end
  110. end
  111.  
  112.  
  113. self.Owner:FireBullets( bullet )
  114. self.Weapon:SendWeaponAnim(self.PrimaryAnim)
  115.  
  116. -- Owner can die after firebullets, giving an error at muzzleflash
  117. if not IsValid(self.Owner) or not self.Owner:Alive() then return end
  118.  
  119. self.Owner:MuzzleFlash()
  120. self.Owner:SetAnimation( PLAYER_ATTACK1 )
  121.  
  122. if self.Owner:IsNPC() then return end
  123.  
  124. if ((SinglePlayer() and SERVER) or
  125. ((not SinglePlayer()) and CLIENT and IsFirstTimePredicted() )) then
  126.  
  127. -- reduce recoil if ironsighting
  128. recoil = sights and (recoil * 0.75) or recoil
  129.  
  130. local eyeang = self.Owner:EyeAngles()
  131. eyeang.pitch = eyeang.pitch - recoil
  132. self.Owner:SetEyeAngles( eyeang )
  133.  
  134. end
  135. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement