SendWeaponAnim doesn't play.

I’m making a shotgun. When it reloads, obviously, shells are slotted in using ACT_VM_RELOAD with SendWeaponAnim. For some reason, the anims only play once. I start reloading with 1/8 shells, play the anim once for 2/8, then nothing until the end reload animation.

I’ve tried placing ACT_VM_IDLE directly before actually playing the animation, and nothing. I do that and delay it 0.03 seconds, and it works, but there’s a brief flash of idle before anything happens.

Any ideas?

I’ve had the exact same problem, except the anims don’t play to begin with. I’d appreciate if anyone had a solution to this.

Code, please?

Sorry for neglecting the topic, was away for a couple weeks.

[lua]
function SWEP:Reload()

local clip = self:Clip1();
local ammo = self:Ammo1();

if( clip >= self.Primary.ClipSize or ammo <= 0 ) then return end
if( CurTime() <= self.NextShot ) then return end

if( self.Reloading == 0 ) then -- init
    
    self:PlayAnim( ACT_SHOTGUN_RELOAD_START );
    self.Owner:SetAnimation( PLAYER_RELOAD );
    self.Reloading = 1;
    self.NextShot = CurTime() + 0.6;
    timer.Simple( 0.6, function() self:Reload() end );
    return;
    
elseif( self.Reloading == 1 ) then -- action
    
    self.Reloading = 2;
    self:EmitSound( table.Random( self.ReloadSounds ) );
    self:SendWeaponAnim( ACT_VM_RELOAD );
    --self:PlayAnim( ACT_VM_RELOAD, ACT_SHOTGUN_PUMP );
    
    timer.Simple( 0.5, function() self:Reload() end );
    self.NextShot = CurTime() + 0.5;
    
else -- add ammo
    
    self:SetClip1( clip + 1 );
    self.Owner:RemoveAmmo( 1, self.Primary.Ammo );
    self.Reloading = 1;
    
    if( self:Clip1() == 8 ) then
        
        self.Reloading = 0;
        self:Pump();
        
    else
        
        self:Reload();
        
    end
    
end

end
[/lua]

SWEP:PlayAnim() (it works but flickers)

[lua]
function SWEP:PlayAnim( act, opt )

if( not opt ) then opt = ACT_VM_IDLE end

self:SendWeaponAnim( opt );
timer.Simple( 0.025, function() self:SendWeaponAnim( act ) end );

end
[/lua]

[editline]08:03PM[/editline]

SWEP:Pump() (in case of curiosity)

[lua]
function SWEP:Pump()

self:PlayAnim( ACT_SHOTGUN_PUMP );
self:PumpSound();

end

function SWEP:PumpSound()

if( SERVER ) then
    
    self:EmitSound( Sound( "weapons/scock1.wav" ) );
    
end

end
[/lua]

I’ve been having this issue as well and it only seems to happen on reload animations, and only in multiplayer ( they play properly in singleplayer ). So I feel it’s a networking thing if anything, given it started happening to me after Garry made SendWeaponAnim shared, I think.