Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. DEFINE_BASECLASS( SWEP.Base )
  2.  
  3. -- First off the Metro Kalash 2012 code, for resetting the bodygroups while the mag is off-screen, BaseClass changed hasn't it, cause its causing the whole swep to seize up, I've tried my best but I cant get it to work, could you have a look? :3
  4.  
  5. local vm
  6. local obg = -1
  7. local targ
  8. local LastReloadTime = -1
  9.  
  10. local offscreentime = 1
  11. local offscreentime_empty = 1
  12.  
  13. function SWEP:Deploy( ... )
  14.     obg = -1
  15.     return BaseClass.Deploy(self, ...)
  16. end
  17.  
  18. function SWEP:Reload( ... )
  19.     obg = -1
  20.     LastReloadTime = CurTime()
  21.     return BaseClass.Reload(self, ... )
  22. end
  23.  
  24. function SWEP:Think2( ... )
  25.     BaseClass.Think2(self, ... )
  26.     if not IsValid(vm) then
  27.         vm = self.OwnerViewModel
  28.         return
  29.     end
  30.  
  31.     if self:GetReloading() and CurTime() > LastReloadTime + ( self:Clip1() <= 0 and offscreentime or offscreentime_empty ) then
  32.         targ = math.Clamp( 20 - math.ceil( ( self:Clip1() + self:Ammo1() ) / 2 ), 0, 20)
  33.     else
  34.         targ = math.Clamp( 20 - math.ceil( self:Clip1()/2 ), 0, 20)
  35.     end
  36.  
  37.     self.Bodygroups_V[4] = targ
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement