Advertisement
HK47

Untitled

Nov 10th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.53 KB | None | 0 0
  1. AddCSLuaFile()
  2.  
  3. SWEP.PrintName = "Unstable Rocket Launcher"
  4. SWEP.Author = "Mind"
  5. SWEP.Instructions = "Blow Up All!"
  6. SWEP.Spawnable = true
  7. SWEP.AdminOnly = false
  8. SWEP.Base = "weapon_base"
  9. SWEP.Category = "Mind's SWEPS"
  10.  
  11. SWEP.Primary.ClipSize = 2
  12. SWEP.Primary.DefaultClip = 20
  13. SWEP.Primary.Automatic = false
  14. SWEP.Primary.Ammo = "RPG_Round"
  15. SWEP.Primary.NumShots = 1
  16. SWEP.Primary.TakeAmmoPerBullet = false
  17.  
  18. SWEP.Secondary.ClipSize = -1
  19. SWEP.Secondary.DefaultClip = -1
  20. SWEP.Secondary.Automatic = false
  21. SWEP.Secondary.Ammo = "none"
  22. SWEP.Secondary.NumShots = 1
  23. SWEP.Secondary.TakeAmmoPerBullet = false
  24.  
  25. SWEP.Weight = 5
  26. SWEP.AutoSwitchTo = true
  27. SWEP.AutoSwitchFrom = false
  28. SWEP.Slot = 3
  29. SWEP.SlotPos = 1
  30. SWEP.DrawAmmo = true
  31. SWEP.DrawCrosshair = true
  32. SWEP.ViewModel = "models/weapons/c_rpg.mdl"
  33. SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl"
  34. SWEP.UseHands = true
  35. SWEP.ViewModelFOV = 64
  36.  
  37. function SWEP:Initialize()
  38. self:SetWeaponHoldType("rpg")
  39. end
  40.  
  41. function SWEP:PrimaryAttack()
  42.  
  43. if ( !self:CanPrimaryAttack() ) then return end
  44.  
  45. self:TakePrimaryAmmo(1)
  46.  
  47. timer.Create("xtremelunch", 0.12, 5, function()
  48.  
  49. if not self.Weapon or not self.Owner then return end
  50.  
  51. self.Weapon:SetNextPrimaryFire( CurTime() + 3 )
  52. self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
  53. self.Owner:SetAnimation(PLAYER_ATTACK1)
  54. self.Owner:MuzzleFlash()
  55. self.Owner:ViewPunch(Angle(math.Rand(-0.25, -0.15), math.Rand(-0.23, 0.23), 0.1 ))
  56.  
  57. if ( CLIENT ) then return end
  58.  
  59. local ent = ents.Create( "rocket_ent" )
  60.  
  61. if ( !IsValid( ent ) ) then return end
  62.  
  63. ent:SetPos(self.Owner:GetShootPos() + self.Owner:EyeAngles():Right() * 10 + self.Owner:GetAimVector() * xxx - self.Owner:EyeAngles():Up() * 6)
  64. ent:SetAngles( self.Owner:EyeAngles() )
  65. ent:SetModel("models/weapons/w_missile_closed.mdl")
  66. ent:SetPhysicsAttacker(self.Owner)
  67. ent:SetOwner(self.Owner)
  68. ent:Spawn()
  69.  
  70. local phys = ent:GetPhysicsObject()
  71.  
  72. if ( !IsValid( phys ) ) then ent:Remove() return end
  73.  
  74. phys:EnableGravity(false)
  75. phys:ApplyForceCenter(self.Owner:GetAimVector() * 1000000000000)
  76.  
  77. cleanup.Add( self.Owner, "props", ent )
  78.  
  79. self:EmitSound("weapons/rpg/rocketfire1.wav")
  80. end)
  81. end
  82.  
  83. SWEP.entr = nil
  84.  
  85. function SWEP:SecondaryAttack()
  86.  
  87. if not self:CanPrimaryAttack() then return end
  88.  
  89. self:TakePrimaryAmmo(1)
  90.  
  91. self.Weapon:SetNextSecondaryFire(CurTime() + 3)
  92.  
  93. self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
  94. self.Owner:SetAnimation(PLAYER_ATTACK1)
  95. self.Owner:MuzzleFlash()
  96. self.Owner:ViewPunch(Angle(math.Rand(-0.25, -0.15), math.Rand(-0.23, 0.23), 0.1))
  97.  
  98. if CLIENT then return end
  99.  
  100. self.entr = ents.Create("homingmiss_ent")
  101. self.entr:SetPos(self.Owner:GetShootPos() + self.Owner:EyeAngles():Right() * 10 + self.Owner:GetAimVector() * 20 - self.Owner:EyeAngles():Up() * 6)
  102. self.entr:SetAngles(self.Owner:EyeAngles())
  103. self.entr:SetModel("models/weapons/w_missile_closed.mdl")
  104. self.entr:SetPhysicsAttacker(self.Owner)
  105. self.entr:SetOwner(self.Owner)
  106. self.entr:Spawn()
  107. self.entr:SetNWBool("hui132123hui", true)
  108.  
  109. local phys = self.entr:GetPhysicsObject()
  110.  
  111. if not IsValid(phys) then self.entr:Remove() return end
  112.  
  113. phys:EnableGravity(false)
  114. phys:ApplyForceCenter(self.Owner:GetAimVector() * 1000000000)
  115.  
  116. cleanup.Add(self.Owner, "props", self.entr)
  117.  
  118. self:EmitSound("weapons/rpg/rocketfire1.wav")
  119. end
  120.  
  121. function SWEP:DrawHUD()
  122.  
  123. local sosiska
  124.  
  125. for k, v in pairs(ents.GetAll()) do
  126. if IsValid(v) and v:GetNWBool("hui132123hui") then if v:GetNWEntity("target") then sosiska = v:GetNWEntity("target"):GetPos():ToScreen() break end end
  127. end
  128.  
  129. if sosiska then
  130. surface.SetDrawColor(Color(0, 255, 10, 230))
  131. surface.DrawLine(sosiska.x, sosiska.y, sosiska.x + 50, sosiska.y)
  132. surface.DrawLine(sosiska.x - 10, sosiska.y, sosiska.x + 50, sosiska.y)
  133. end
  134. end
  135.  
  136. function SWEP:Reload()
  137. self:DefaultReload(ACT_VM_RELOAD)
  138. return true
  139. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement