Guest User

Harpoon

a guest
Mar 23rd, 2014
195
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Variables that are used on both client and server
  2. SWEP.Gun = ("m9k_harpoon") -- must be the name of your swep but NO CAPITALS!
  3. SWEP.Category = "M9K Specialties"
  4. SWEP.Author = ""
  5. SWEP.Contact = ""
  6. SWEP.Purpose = ""
  7. SWEP.Instructions = ""
  8. SWEP.MuzzleAttachment = "1" -- Should be "1" for CSS models or "muzzle" for hl2 models
  9. SWEP.ShellEjectAttachment = "2" -- Should be "2" for CSS models or "1" for hl2 models
  10. SWEP.PrintName = "Harpoon" -- Weapon name (Shown on HUD)
  11. SWEP.Slot = 6 -- Slot in the weapon selection menu
  12. SWEP.SlotPos = 103 -- Position in the slot
  13. SWEP.DrawAmmo = false -- Should draw the default HL2 ammo counter
  14. SWEP.DrawWeaponInfoBox = false -- Should draw the weapon info box
  15. SWEP.BounceWeaponIcon = false -- Should the weapon icon bounce?
  16. SWEP.DrawCrosshair = false -- set false if you want no crosshair
  17. SWEP.Weight = 1 -- rank relative ot other weapons. bigger is better
  18. SWEP.AutoSwitchTo = true -- Auto switch to if we pick it up
  19. SWEP.AutoSwitchFrom = true -- Auto switch from if you pick up a better weapon
  20. SWEP.HoldType = "melee" -- how others view you carrying the weapon
  21. -- normal melee melee2 fist knife smg ar2 pistol rpg physgun grenade shotgun crossbow slam passive
  22. -- you're mostly going to use ar2, smg, shotgun or pistol. rpg and ar2 make for good sniper rifles
  23.  
  24. SWEP.ViewModelFOV = 70
  25. SWEP.ViewModelFlip = false
  26. SWEP.ViewModel = "models/weapons/v_invisib.mdl" -- Weapon view model
  27. SWEP.WorldModel = "models/weapons/w_harpooner.mdl" -- Weapon world model
  28. SWEP.Base = "weapon_tttbase"
  29. SWEP.Spawnable = true
  30. SWEP.AdminSpawnable = true
  31. SWEP.FiresUnderwater = false
  32. SWEP.ShowWorldModel = true
  33.  
  34. SWEP.Primary.Sound = Sound("") -- Script that calls the primary fire sound
  35. SWEP.Primary.RPM = 60 -- This is in Rounds Per Minute
  36. SWEP.Primary.ClipSize = 1 -- Size of a clip
  37. SWEP.Primary.DefaultClip = 1 -- Bullets you start with
  38. SWEP.Primary.KickUp = 0 -- Maximum up recoil (rise)
  39. SWEP.Primary.KickDown = 0 -- Maximum down recoil (skeet)
  40. SWEP.Primary.KickHorizontal = 0 -- Maximum up recoil (stock)
  41. SWEP.Primary.Automatic = false -- Automatic = true; Semi Auto = false
  42. SWEP.Kind = WEAPON_EQUIP
  43. SWEP.CanBuy = {ROLE_DETECTIVE} -- only detectives can buy
  44. SWEP.LimitedStock = true -- only buyable once
  45.  
  46. -- pistol, 357, smg1, ar2, buckshot, slam, SniperPenetratedRound, AirboatGun
  47. -- Pistol, buckshot, and slam always ricochet. Use AirboatGun for a metal peircing shotgun slug
  48.  
  49. SWEP.Primary.Round = ("m9k_thrown_harpoon") --NAME OF ENTITY GOES HERE
  50.  
  51. SWEP.Secondary.IronFOV = 60 -- How much you 'zoom' in. Less is more!
  52.  
  53. SWEP.Primary.NumShots = 0 -- How many bullets to shoot per trigger pull
  54. SWEP.Primary.Damage = 3000 -- Base damage per bullet
  55. SWEP.Primary.Spread = 0 -- Define from-the-hip accuracy (1 is terrible, .0001 is exact)
  56. SWEP.Primary.IronAccuracy = 0 -- Ironsight accuracy, should be the same for shotguns
  57. --none of this matters for IEDs and other ent-tossing sweps
  58.  
  59. -- Enter iron sight info and bone mod info below
  60. SWEP.IronSightsPos = Vector(0, -12.952, -2.951)
  61. SWEP.IronSightsAng = Vector(64.835, 0, 0)
  62. SWEP.SightsPos = Vector(0, -12.952, -2.951)
  63. SWEP.SightsAng = Vector(64.835, 0, 0)
  64. SWEP.RunSightsPos = Vector(0, 12.295, 10.656)
  65. SWEP.RunSightsAng = Vector(-145, 3.5, 0)
  66.  
  67.  
  68.  
  69. -- SWEP.WElements = {
  70. -- ["harpoon"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(4.413, 5.945, -0.894), angle = Angle(-5.52, -71.026, -122.169), size = Vector(0.578, 0.578, 0.578), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
  71. -- }
  72.  
  73. if file.Exists( "models/weapons/v_knife_t.mdl", "GAME" ) then
  74. SWEP.ViewModel = "models/weapons/v_knife_t.mdl" -- Weapon view model
  75. SWEP.VElements = {
  76. ["harpoon"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "v_weapon.knife_Parent", rel = "", pos = Vector(6.3, -6.481, -5.825), angle = Angle(128.731, -17.442, -142.782), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
  77. }
  78. SWEP.ViewModelBoneMods = {
  79. ["v_weapon.Knife_Handle"] = { scale = Vector(1, 1, 1), pos = Vector(-30, 30, -30), angle = Angle(0, 0, 0) },
  80. ["v_weapon.Right_Arm"] = { scale = Vector(1, 1, 1), pos = Vector(-30, 30, 30), angle = Angle(0, 0, 0) }
  81. }
  82. else
  83. SWEP.ViewModel = "models/weapons/v_invisib.mdl" -- Weapon view model
  84. SWEP.VElements = {
  85. ["harpoon"] = { type = "Model", model = "models/props_junk/harpoon002a.mdl", bone = "Da Machete", rel = "", pos = Vector(-9.362, 2.611, 12.76), angle = Angle(60.882, 128.927, 105.971), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
  86. }
  87. SWEP.ViewModelBoneMods = {
  88. ["l-upperarm"] = { scale = Vector(1, 1, 1), pos = Vector(-7.286, 1.628, 7.461), angle = Angle(7.182, 0, 0) },
  89. ["r-upperarm-movement"] = { scale = Vector(1, 1, 1), pos = Vector(-30, -30, -30), angle = Angle(0, 0, 0) },
  90. ["l-upperarm-movement"] = { scale = Vector(1, 1, 1), pos = Vector(3.615, 0.547, 4.635), angle = Angle(-45.929, -39.949, -76.849) },
  91. ["l-forearm"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-3.932, -42.389, 171.466) },
  92. ["r-upperarm"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(7.336, 0, 0) },
  93. ["lwrist"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-47.502, -5.645, 0.551) }
  94. }
  95.  
  96. end
  97.  
  98.  
  99. function SWEP:PrimaryAttack()
  100. self:FireRocket()
  101. self.Owner:SetAnimation( PLAYER_ATTACK1 )
  102. self.Weapon:SetNextPrimaryFire(CurTime()+1/(self.Primary.RPM/60))
  103. self.Weapon:EmitSound(Sound("Weapon_Knife.Slash"))
  104. self.Weapon:TakePrimaryAmmo(1)
  105. self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
  106. self:CheckWeaponsAndAmmo()
  107. end
  108.  
  109. function SWEP:FireRocket()
  110. pos = self.Owner:GetShootPos()
  111. if SERVER then
  112. local rocket = ents.Create(self.Primary.Round)
  113. if !rocket:IsValid() then return false end
  114. rocket:SetAngles(self.Owner:GetAimVector():Angle())
  115. rocket:SetPos(pos)
  116. rocket:SetOwner(self.Owner)
  117. rocket:Spawn()
  118. rocket.Owner = self.Owner
  119. rocket:Activate()
  120. eyes = self.Owner:EyeAngles()
  121. local phys = rocket:GetPhysicsObject()
  122. phys:SetVelocity(self.Owner:GetAimVector() * 2000)
  123. end
  124. if SERVER and !self.Owner:IsNPC() then
  125. local anglo = Angle(-10, -5, 0)
  126. self.Owner:ViewPunch(anglo)
  127. end
  128.  
  129. end
  130.  
  131. function SWEP:CheckWeaponsAndAmmo()
  132.  
  133. if SERVER and self.Weapon != nil and ((gmod.GetGamemode().Name == "Murderthon 9000") or GetConVar("DebugM9K"):GetBool()) then
  134. timer.Simple(.1, function()
  135. if SERVER then
  136. if not IsValid(self) then return end
  137. if self.Owner == nil then return end
  138. self.Owner:StripWeapon(self.Gun)
  139. end
  140. end)
  141. return end
  142.  
  143. if SERVER and self.Weapon != nil then
  144. if self.Weapon:Clip1() == 0 && self.Owner:GetAmmoCount( self.Weapon:GetPrimaryAmmoType() ) == 0 then
  145. timer.Simple(.1, function() if SERVER then if not IsValid(self) then return end
  146. if self.Owner == nil then return end
  147. self.Owner:StripWeapon(self.Gun)
  148. end end)
  149. else
  150. self:Reload()
  151. end
  152. end
  153. end
  154.  
  155. function SWEP:Reload()
  156. if not IsValid(self) then return end if not IsValid(self.Owner) then return end
  157.  
  158. if self.Owner:IsNPC() then
  159. self.Weapon:DefaultReload(ACT_VM_RELOAD)
  160. return end
  161.  
  162. if self.Owner:KeyDown(IN_USE) then return end
  163. self.Weapon:DefaultReload(ACT_VM_DRAW)
  164.  
  165. if !self.Owner:IsNPC() then
  166. if self.Owner:GetViewModel() == nil then self.ResetSights = CurTime() + 3 else
  167. self.ResetSights = CurTime() + self.Owner:GetViewModel():SequenceDuration()
  168. end
  169. end
  170. end
  171.  
  172. function SWEP:SecondaryAttack()
  173. return false
  174. end
  175.  
  176. function SWEP:Think()
  177. end
  178.  
  179. if (gmod.GetGamemode().Name == "Murderthon 9000") or GetConVar("DebugM9K"):GetBool() then
  180. SWEP.Primary.ClipSize = -1 -- Size of a clip
  181. SWEP.Primary.DefaultClip = -1 -- Bullets you start with
  182. SWEP.Primary.Ammo = "none"
  183. end
RAW Paste Data