Advertisement
ReverendV92

SG Reload Experimental

Jan 1st, 2017
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1.  
  2. function SWEP:ShotgunReload( status )
  3.  
  4.     if IsValid( self.Owner ) then
  5.  
  6.         local Status = math.floor( status or 0 )
  7.         local StartSGReload = 0
  8.         local IsSGReloading = 1
  9.         local EndSGReload = math.ceil( 2 )
  10.         print( "Status is: " .. Status )
  11.  
  12.         if Status <= StartSGReload then
  13.             self:SendWeaponAnim( ACT_SHOTGUN_RELOAD_START )
  14.             self.ActionDelay = CurTime() + self.Owner:GetViewModel():SequenceDuration()
  15.             self:SetNextPrimaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
  16.             self:SetNextSecondaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
  17.            
  18.             self:Set_IsShotgunReloading( true )
  19.             Status = IsSGReloading
  20.             self:ShotgunReload( Status )
  21.         end
  22.        
  23.         if Status == IsSGReloading then
  24.             self:SendWeaponAnim(ACT_VM_RELOAD)
  25.             self.ActionDelay = CurTime() + self.Owner:GetViewModel():SequenceDuration()
  26.             self:SetNextPrimaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
  27.             self:SetNextSecondaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
  28.             self:SetClip1(self:Clip1() + 1)
  29.             self.Owner:RemoveAmmo( 1, self.Primary.Ammo )
  30.         end
  31.        
  32.         if self:Clip1() >= ( self.Primary.ClipSize + self.Primary.ClipSizePlus ) then
  33.             Status = EndSGReload
  34.             self:ShotgunReload( Status )
  35.         end
  36.  
  37.         if Status >= EndSGReload then
  38.             self:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH )
  39.             self.ActionDelay = CurTime()
  40.             self:Set_IsShotgunReloading( false )
  41.             self:SetNextPrimaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
  42.             self:SetNextSecondaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration())
  43.             self:Set_IsReloading( false )
  44.             return false
  45.         end
  46.  
  47.     end
  48.    
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement