Advertisement
HK47

Untitled

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