Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. AddCSLuaFile()
  2. SWEP.PrintName = "Thundergun"
  3. SWEP.Author = "Raven"
  4. SWEP.Purpose = ""
  5. SWEP.Slot = 3
  6. SWEP.SlotPos = 2
  7. SWEP.Spawnable = true
  8. SWEP.Category = "CoD Zombies"
  9. SWEP.ViewModelFOV = 55
  10. SWEP.ViewModel = "models/weapons/thundergun/v_thundergun.mdl"
  11. SWEP.WorldModel = "models/weapons/thundergun/w_thundergun.mdl"
  12. SWEP.UseHands = true
  13. SWEP.NZWonderWeapon = true
  14. SWEP.NZPaPName = "Zeus Cannon"
  15. SWEP.DrawAmmo = true
  16. SWEP.Primary.ClipSize = 2
  17. SWEP.Primary.DefaultClip = 14
  18. SWEP.Primary.Automatic = false
  19. SWEP.Primary.Ammo = "Wind Reels"
  20. SWEP.Secondary.Ammo = "none"
  21. local FireSND = "staff/air/shoot.mp3"
  22. game.AddAmmoType({
  23. name = "Wind Reels",
  24. dmgtype = DMG_CRUSH,
  25. tracer = TRACER_NONE,
  26. plydmg = 100,
  27. npcdmg = 500,
  28. force = 20000,
  29. minsplash = 100,
  30. maxsplash = 150
  31. })
  32. function SWEP:Initialize()
  33. self.Weapon:SetHoldType("crossbow")
  34. end
  35. function SWEP:Reload()
  36. if self:Ammo1() <= 0 or self:Clip1()>0 then
  37. return
  38. end
  39. self:DefaultReload(ACT_VM_RELOAD)
  40. end
  41.  
  42. function SWEP:PrimaryAttack()
  43. if !self:CanPrimaryAttack() then
  44. self:Reload()
  45. return
  46. end
  47. local o = self.Owner
  48. if !IsValid(o) then
  49. return
  50. end
  51. self:SetNextPrimaryFire(CurTime() + 1)
  52. local clip = self:Clip1()
  53. if clip == 2 then
  54. self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
  55. self.Weapon:EmitSound("thundergun/shoot.mp3")
  56. elseif clip == 1 then
  57. self:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
  58. self.Weapon:EmitSound("thundergun/shoot_last_bullet.mp3")
  59. end
  60. local ed,obj,start,up = EffectData(),o:LookupAttachment("anim_attachment_RH"),nil,o:GetUp()
  61. if obj ~= 0 then
  62. local pos = o:GetAttachment(obj)
  63. start = pos.Pos
  64. ed:SetEntity(o)
  65. ed:SetAttachment(obj)
  66. ed:SetAngles(pos.Ang)
  67. else
  68. start = o:GetShootPos()
  69. self:SendWeaponAnim(ACT_VM_IDLE)
  70. ed:SetEntity(self)
  71. ed:SetAttachment(1)
  72. ed:SetAngles(self:GetAimVector())
  73. end
  74. start = start + o:GetForward()*30
  75. ed:SetStart(start)
  76. util.Effect( "effect_smokering", ed )
  77. self:DoShot(o,start,up)
  78. timer.Simple(0.2,function()if IsValid(self) then self:DoShot(o,start,up)end end)
  79. --debugoverlay.Sphere( start, 5, 1, Color(255,255,255) )
  80. o:SetAnimation( PLAYER_ATTACK1 )
  81. self:TakePrimaryAmmo(1)
  82. end
  83. function SWEP:DoShot(o,start,up)
  84. if CLIENT then return end
  85.  
  86. local ConeEnts = ents.FindInCone(self:GetOwner():GetShootPos(),
  87. self:GetOwner():GetAimVector(),
  88. 65535,90)
  89. for k,v in pairs(ents.FindInCone( o:LocalToWorld(o:OBBCenter()) + (o:GetForward() * -25), o:GetAngles():Forward(), 500, 0 ), o:GetAimVector() 10,)) dofor i, pEnt in ipairs(ConeEnts) do
  90. if pEnt:IsNPC() then
  91.  
  92.  
  93.  
  94. if v == o or !IsValid(v) then continue end
  95. local tr = util.TraceLine({start=start,endpos=v:GetPos(),mask=MASK_SHOT_HULL})
  96. local p = v:IsPlayer()
  97. if v:IsNPC() or p then
  98. if p and !hook.Run("PlayerShouldTakeDamage",v,o) then
  99. continue
  100. end
  101. local class = v:GetClass()
  102. if class == "npc_helicopter" or class == "npc_combinegunship" then
  103. v:SetVelocity((v:GetPos()-start):GetNormal()*2500)
  104. timer.Simple(0.5,function()if IsValid(v) then v:Fire("selfdestruct")end end)
  105. elseif class == "npc_strider" then
  106. v:SetVelocity((v:GetPos()-start):GetNormal()*1000)
  107. timer.Simple(0.1,function()if IsValid(v) then v:Fire("break")end end)
  108. else
  109. if v:IsOnGround() then
  110. local ppos = v:GetPos()
  111. v:SetVelocity((ppos-start):GetNormal()*25000000/start:Distance(ppos)+up*1000)
  112. else
  113. v:SetVelocity((v:GetPos()-start):GetNormal()*1000)
  114. end
  115. timer.Simple(0.2,function()if IsValid(v) then v:TakeDamage(v:Health(),o,self.Weapon)end end)
  116. end
  117. elseif v.Type == "nextbot" then
  118. v.loco:SetVelocity((v:GetPos()-start):GetNormal()*5000+up*1000)
  119. timer.Simple(0.2,function()if IsValid(v) then v:TakeDamage(v:Health(),o,self.Weapon)end end)
  120. end
  121. end
  122. end
  123. function SWEP:SecondaryAttack()
  124. end
  125. function SWEP:Deploy()
  126. NextReload = CurTime() + 1
  127. self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
  128. end
  129. function SWEP:Holster()
  130. return true
  131. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement