I’m trying to make a swep capable of reloading even if it has a full magazine already. (If someone knows how to force a reload even with a full mag, please let me know because it will make all my problems go away)
I’m doing this by doing self:SendWeaponAnim( ACT_VM_RELOAD ) which works very well about 50% of the time. The other 50% the animation plays for like 4 frames of animation before toggling to idle abruptly.
I’ve tried doing things like sending ACT_VM_IDLE just before reloading, as well as waiting in a timer for a very small time after sending idle before reloading and neither seemed to work.
If anyone has any ideas I would love to hear them.
function SWEP:Reload() if not IsFirstTimePredicted() then return end //Prevents reloading while reloading if self.reloadLock then return end if( self:Clip1() >= self:GetMaxClip1() or self:Clip1() == 0 ) then self.reloadLock = true local seq = self:LookupSequence( "reload" ) local dur = self:SequenceDuration( seq ) self:SetNextPrimaryFire( CurTime() + dur ) timer.Simple( dur, function() if not IsValid( self ) then return end self.reloadLock = nil //Interface with renegade hud to show ammo count timerLen = 5 timer.Create( "RenHUDAmmoSideTimer", timerLen, 1, function() end) end ) if CLIENT then self:SendWeaponAnim( ACT_VM_RELOAD ) end else self:DefaultReload( ACT_VM_RELOAD ) end self:EmitSound( "rifl/rifle_reload.wav", _, _, _, CHAN_WEAPON ) end