Advertisement
Guest User

rd_fisticuffs.lua

a guest
Dec 6th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. SWEP.PrintName = "Fisticuffs"
  2.  
  3. SWEP.Author = "Matthew 'DeadVCR' Suddaby"
  4. SWEP.Instructions = "Fist people."
  5. SWEP.Contact = "no@never.com"
  6. SWEP.Purpose = "to be a SWEP"
  7.  
  8. SWEP.AdminSpawnable = false
  9. SWEP.Spawnable = true
  10.  
  11. SWEP.ViewModelFOV = 54
  12. SWEP.ViewModel = Model( "models/weapons/rd_fisticuffs.mdl" )
  13. SWEP.WorldModel ""
  14. SWEP.UseHands = true
  15.  
  16. SWEP.AutoSwitchTo = false
  17. SWEP.AutoSwitchFrom = true
  18. SWEP.Slot = 1
  19. SWEP.SlotPos = 4
  20.  
  21. SWEP.HoldType = "Melee"
  22.  
  23. SWEP.FiresUnderwater = true
  24.  
  25. SWEP.Weight = 5
  26.  
  27. SWEP.DrawCrosshair = false
  28.  
  29. SWEP.Category = "Resonance Duel"
  30.  
  31. SWEP.DrawAmmo = false
  32.  
  33. SWEP.HitDistance = 48
  34.  
  35. SWEP.base = "weapon_base"
  36.  
  37. SWEP.Primary.ClipSize = -1
  38. SWEP.Primary.DefaultClip = -1
  39. SWEP.Primary.Automatic = true
  40. SWEP.Primary.Ammo = "none"
  41.  
  42.  
  43. SWEP.Secondary.ClipSize = -1
  44. SWEP.Secondary.DefaultClip = -1
  45. SWEP.Secondary.Automatic = true
  46. SWEP.Secondary.Ammo = "none"
  47.  
  48.  
  49. local SwingSound = Sound( "WeaponFrag.Throw" )
  50. local HitSound = Sound( "Flesh.ImpactHard" )
  51.  
  52. function SWEP:Initialize()
  53.  
  54.     self:SetHoldType( "fist" )
  55.  
  56. end
  57.  
  58. function SWEP:UpdateNextIdle()
  59.  
  60.     local vm = self.Owner:GetViewModel()
  61.     self:SetNextIdle( CurTime() + vm:SequenceDuration() / vm:GetPlaybackRate() )
  62.  
  63. end
  64.  
  65. function SWEP:Deploy()
  66.  
  67.     local speed = GetConVarNumber( "sv_defaultdeployspeed" )
  68.  
  69.     local vm = self.Owner:GetViewModel()
  70.     vm:SendViewModelMatchingSequence( vm:LookupSequence( "fists_draw" ) )
  71.     vm:SetPlaybackRate( speed )
  72.  
  73.     self:SetNextPrimaryFire( CurTime() + vm:SequenceDuration() / speed )
  74.     self:SetNextSecondaryFire( CurTime() + vm:SequenceDuration() / speed )
  75.     self:UpdateNextIdle()
  76.  
  77.     if ( SERVER ) then
  78.         self:SetCombo( 0 )
  79.     end
  80.  
  81.     return true
  82.  
  83. end
  84.  
  85. function SWEP:SecondaryAttack()
  86.  
  87.     self:PrimaryAttack( true )
  88.  
  89. end
  90.  
  91. function SWEP:Think()
  92.  
  93.     local vm = self.Owner:GetViewModel()
  94.     local curtime = CurTime()
  95.     local idletime = self:GetNextIdle()
  96.  
  97.     if ( idletime > 0 && CurTime() > idletime ) then
  98.  
  99.         vm:SendViewModelMatchingSequence( vm:LookupSequence( "fists_idle_0" .. math.random( 1, 2 ) ) )
  100.  
  101.         self:UpdateNextIdle()
  102.  
  103.     end
  104.  
  105.     local meleetime = self:GetNextMeleeAttack()
  106.  
  107.     if ( meleetime > 0 && CurTime() > meleetime ) then
  108.  
  109.         self:DealDamage()
  110.  
  111.         self:SetNextMeleeAttack( 0 )
  112.  
  113.     end
  114.  
  115.     if ( SERVER && CurTime() > self:GetNextPrimaryFire() + 0.1 ) then
  116.  
  117.         self:SetCombo( 0 )
  118.  
  119.     end
  120.  
  121. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement