Hey, I've been messing with sweps and got actually a big problem with reload animation for weapons. In singleplayer everything is perfect, but when I tried to test it serverside, i got this problem. So you can see everything on this video:
https://youtu.be/4pdRdekkXzw
For the code I use this:
vm:SendViewModelMatchingSequence( vm:LookupSequence( self.RelAnimSeq ) )
I tried to use SendWeaponAnim() - got even worse result
So if someone can help me, would be great
Make sure to call it in a shared hook. This could work too: Weapon/DefaultReload
I tried it too, but noting again
Because coding stuff to work properly in SP and MP is a pain in the ass, especially weapons. The code that runs in SP might not run in MP, mainly CLIENT/SERVER stuff, so it is important to make sure that what runs in SP runs the same in MP, and if need be, use Net messages to get shit done. If you are playing the weapon animations serverside in SP (due to Predicted hooks not being called clientside in SP), in MP this can lead to animations being out of sync, fucked up completely or many different problems.
I might be wrong, but I don't think you should use net messages here. The reload function should be fully predicted.
The issue might be that the reload function isn't played on serverside. Use debug messages to figure it out, or give us the code so we can help.
They are on the server too, and with the shotguns is everything ok. I tried to use net msgs - useless. So the part with reloading (inside swep's Think func):
if self.ShotgunReloadState == 1 then
if self.Owner:KeyPressed(IN_ATTACK) then
self.ShotgunReloadState = 2
end
if CT > self.ReloadDelay and IFTP then
local vm = self.Owner:GetViewModel()
vm:SendViewModelMatchingSequence( vm:LookupSequence( self.ShotRelAnim ) )
mag, ammo = self:Clip1(), self.Owner:GetAmmoCount(self.Primary.Ammo)
if SERVER then
self:SetClip1(mag + 1)
self.Owner:SetAmmo(ammo - 1, self.Primary.Ammo)
end
local dur = vm:SequenceDuration()
self.ReloadDelay = CT + dur
if mag + 1 == self.Primary.ClipSize or ammo - 1 == 0 then
self.ShotgunReloadState = 2
end
end
end
Sorry, you need to Log In to post a reply to this thread.