Full animations don't work.

When shooting a pistol, the slider thing doesn’t fully slide back. it only slides halfway and then back. however it works fine in multiplayer.
how do i fix this? here is the shared.lua

SWEP.ViewModel = "models/weapons/cof/v_glock.mdl" 
SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl" 
SWEP.AutoSwitchTo = true 
SWEP.Slot = 1 
SWEP.Spawnable 			= true					-- Non admin players may spawn this
SWEP.HoldType = "revolver" 
SWEP.PrintName = "Glock 19 9mm"  
SWEP.Author = "Commandersparklz" 
SWEP.Spawnable = true  
SWEP.AutoSwitchFrom = false 
SWEP.FiresUnderwater = false 
SWEP.ViewModelFOV = 90
SWEP.Weight = 5 
SWEP.DrawCrosshair = true 
SWEP.Category = "Cry of Fear" 
SWEP.SlotPos = 0 
SWEP.DrawAmmo = true  
SWEP.Instructions = "The one and only popular weapon... The glock..."   
SWEP.Contact = "anderslordi@gmail.com Or the workshop page"  
SWEP.Purpose = "" 
SWEP.base = "weapon_base"
SWEP.Primary.Ammo = "pistol"                                    
SWEP.Primary.Spread = 0.2                    
SWEP.Primary.NumberofShots = 1                  
SWEP.Primary.TakeAmmo = 1
SWEP.Primary.Automatic = false                   
SWEP.Primary.Recoil = 0                         
SWEP.Primary.ClipSize = 15                    
SWEP.Primary.Delay = 0.1                         
SWEP.Primary.Force = 1                                                     
SWEP.Primary.Sound = "weapons/cof/glock/glock_fire.wav"
SWEP.Primary.Damage = 13

SWEP.Secondary.ClipSize = -1                    
SWEP.Secondary.Delay = 0.7              
SWEP.Secondary.Ammo = "none"

function SWEP:Initialize()

function SWEP:Deploy()
	self.Weapon:SendWeaponAnim( ACT_VM_DRAW )

function SWEP:PrimaryAttack()
	if ( !self:CanPrimaryAttack() ) then return end
		self.Owner:ViewPunch( Angle( math.random(-0.5,0.5), math.random(-0.5,0.5), 0 ) )
	local bullet = {}
		bullet.Num = self.Primary.NumberofShots
		bullet.Src = self.Owner:GetShootPos()
		bullet.Dir = self.Owner:GetAimVector()
		bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
		bullet.Tracer = 1
		bullet.Force = self.Primary.Force
		bullet.Damage = self.Primary.Damage
		bullet.AmmoType = self.Primary.Ammo
	local rnda = self.Primary.Recoil * -1
	local rndb = self.Primary.Recoil * math.random(-1, 1)
	self.Owner:FireBullets( bullet )
	self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
	self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )

function SWEP:SecondaryAttack()
local trace = self.Owner:GetEyeTrace()

	self.Weapon:SendWeaponAnim( ACT_VM_SWINGHIT )
	timer.Create( "punch", 0.34, 1, function()
	local trace = self.Owner:GetEyeTrace()
if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then
	bullet = {}
	bullet.Num    = 1
	bullet.Src    = self.Owner:GetShootPos()
	bullet.Dir    = self.Owner:GetAimVector()
	bullet.Spread = Vector(0, 0, 0)
	bullet.Tracer = 0
	bullet.Force  = 3
	bullet.Damage = 5
self.Weapon:EmitSound("physics/flesh/flesh_impact_bullet" .. math.random( 3, 5 ) .. ".wav")
	self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
	self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
	self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )

function SWEP:Reload()
	if ( self:Clip1() <= 0 ) then
		timer.Create( "reload1", 0.09, 1, function()
		self.Owner:EmitSound( "weapons/cof/glock/glock_magout.wav" )
		timer.Create( "reload2", 1.2, 1, function()
		self.Owner:EmitSound( "weapons/cof/glock/glock_magplace.wav" )
		timer.Create( "reload3", 1.7, 1, function()
		self.Owner:EmitSound( "weapons/cof/glock/glock_magin.wav" )
		timer.Create( "reload4", 2.44, 1, function()
		self.Owner:EmitSound( "weapons/cof/glock/glock_rackback.wav" )
		timer.Create( "reload5", 2.64, 1, function()
		self.Owner:EmitSound( "weapons/cof/glock/glock_slide.wav" )
		timer.Create( "reload1", 0.09, 1, function()
		self.Owner:EmitSound( "weapons/cof/glock/glock_magout.wav" )
		timer.Create( "reload2", 1.2, 1, function()
		self.Owner:EmitSound( "weapons/cof/glock/glock_magplace.wav" )
		timer.Create( "reload3", 1.7, 1, function()
		self.Owner:EmitSound( "weapons/cof/glock/glock_magin.wav" )

[editline]2nd September 2013[/editline]

Also the sounds i tried to use said it has an invalid sample rate.
how do i fix this. i tried to hex them

You tried to hex sounds? You can fix sample rate by resaving the sound using Audacity or Wavosaur with correct samplerate. ( 41000 Hz if I am not mistaken )

oh ok. and the animations?

I don’t know what’s happening, post a video comparison?

ok so i got the sounds to work.
i will provide screens eventually becase i cant record. my gmod is way too slow after Steampipe :confused:

This is what my Weapon does on shooting. it recoils a little bit upwards, and the slide slides back a little too. http://gyazo.com/3603c7df2e84b86080585e54c04906be
This is what its supposed to do. http://gyazo.com/b943f0ee67eccf08a2c51c242047dea8
how do i get it to do that? and set the recoil accordingly?

The model must have a Snap command in the shoot sequence.

Download OpenSourceBroadcaster; next, set up a TWITCH.TV account. Set up OBS to work with twitch.

Stream a short demonstration ( note that when you start streaming, it can take a few seconds for the stream to actually register, and it may cut off the last few seconds, so let it run a few seconds longer )

Twitch creates a temporary video automatically from your stream which stays up as long as it gets views ( I believe ) unless you set it as a highlight, whereby it stays forever.

This is the one of the absolute best ways to do recordings in gmod for debugging, or to show issues.

Also, as soon as you have the animation start, try this:

[lua]self.Owner:GetViewModel():SetPlaybackRate( 0.1 )[/lua]

This slows the playback rate of the animation down quite a bit. From there you can see if something else is canceling it after it starts, or see if the animation plays through.

ok i got my Twitch account setup. what’s next? record and upload or live stream?

[editline]4th September 2013[/editline]

meh never mind, ill record and put it up eventually.
Does anyone know how to make a custom Muzzle Flash act EXACTLY like in cry of fear?

Just hit stream, once you put your unique code in, after you set up your scenes ( Game window, Garry’s mod, while it’s running to set it up ).

Then it’ll appear on twitch right away :slight_smile:

Can i add someone so i don’t have to keep making posts and being a leech on society?
for some reason it the video doesn’t stream to twitch. Idk why, but it’s not working. Twitch says i’m offline but i’m not. I got everything verified too.

Sure, feel free to add me so you can get it set up, then post the video here so that everyone can see the issue. Here’s a quick run through of the settings though!

Edit, make sure you set
:: Settings > Settings > Broadcast Settings > Mode = “Live Stream”
:: Settings > Settings > Broadcast Settings > Streaming Service = “Twitch / Justin.tv
:: Settings > Settings > Broadcast Settings > Server = “Closest to you is better”
:: Settings > Settings > Broadcast Settings > Play Path / Stream Key ( if any ) = “This is your Twitch stream key, the LONG ID they give you HERE http://www.twitch.tv/broadcast when you click SHOW KEY after logging in!”
:: Settings > Settings > Broadcast Settings > Auto-Reconnect = checked
:: Settings > Settings > Broadcast Settings > Auto-Reconnect Timeout: = 10, or so
:: Settings > Settings > Broadcast Settings > Delay ( seconds ) = 0
:: Settings > Settings > Broadcast Settings > Minimize Network Impact = Unchecked
:: Settings > Settings > Broadcast Settings > Dashboard Link ( if any ) = blank
:: Settings > Settings > Broadcast Settings > Save to file = “your preference”
:: Settings > Settings > Broadcast Settings > File-Path = “your preference”
:: Settings > Settings > Broadcast Settings > Start Stream Hotkey = “your preference, I use the Start / Stop streaming button, but if you’re full screen this could be beneficial”
:: Settings > Settings > Broadcast Settings > Stop Stream Hotkey = “your preference, I use the Start / Stop streaming button, but if you’re full screen this could be beneficial”
:: Settings > Settings > Encoding > “Quality Balance” = 7-10 depending on your computer
:: Settings > Settings > Encoding > “Max Bitrate kb/s” 500-5000 depending on your connection
:: Settings > Settings > Encoding > “Buffer Size kbit” match or exceed Bitrate depending on your computer
:: Settings > Settings > Video > Base Resolution > Choose a monitor, or set a custom height ( I run GMOD in windowed mode, so I use 1280 x 1024 CUSTOM )
:: Settings > Settings > Video > “Resolution Downscale” = depending on your computer. Usually none for full quality, or as your go down, the more compression, less data to send.
:: Settings > Settings > Video > “FPS” = 24 is generally accepted movie format speed, but they use techniques to blends the frames together to make it appear faster, I’d recommend 30 or more.

Setting up these settings is very important, if you set them too high as in more than your PC can handle, you will lock up the computer and have to reboot.

It’s better to start low and work your way up.

Next, you set up the Scenes ( Make sure Garry’s Mod is running ):

> Right click the Scenes Box and “Add Scene” > “Garry’s Mod” or whatever unique identifier to help you remember what you’re recording in this scene.
> Click on your scene so that it’s selected.
> Right click the Sources Box and “Add Source” > “Game Capture” > “Garry’s Mod” or whatever unique identifier to help you remember which game-window this is.
> Select Application > “[hl2: Garry’s Mod]”
> Checkmark = “Capture mouse cursor”
> Ok.
> In the Sources Box, make sure that “Garry’s Mod” is checked.

I did exactly those. it keeps failing to connect to twitch. Idk why… plus Twitch says I’m offiline regardless of me streaming or not.
Btw i sent you a request…

If it fails to connect, there might be something else wrong. If you have white space before / at the end of the key, that might cause it. Did you verify your email address? There might be some other steps for that.

Do you have a firewall blocking the connection? But then again, is should be fine… What’s the exact error?

This is a thread to fix animations, not to setup twitch.

^ Here you see a video where the Snap command hasn’t been added to the compile, and below you see after it has been added:

So, how exactly do i fix this?

What exactly are we looking at? It appears, to me anyway, that the slide is moving backwards each time you fire??

But, you can double check to make sure you have IsFirstTimePredicted( ) in your code, so that the client only calls it once, and I’m pretty sure the server is supposed to call the animations for the client.

It’s doing exactly what’s in the first video.
How do i fix all of this?
can you edit my shared.lua and post it?

Tell me exactly what I’m looking at, or what I am looking for, in the first video please.

You’ll need to get the model source. ( You need to edit .qc file of your model source )