Swep not firing silenced anims

Ok, I’m trying to make this swep permanently silenced, and its made some progress, but the deploy animations are bugged and the firing animations arent running at all. Here’s my code, what do I have to do to run the animation correctly ? Please help me lol.
if ( SERVER ) then

AddCSLuaFile( "shared.lua" )

SWEP.HoldType			= "pistol"


if ( CLIENT ) then

SWEP.PrintName			= "USP"			
SWEP.Author				= "Stretch"

SWEP.Slot				= 1
SWEP.SlotPos			= 1
SWEP.IconLetter			= "a"

killicon.AddFont( "garrysfield_usp", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )


SWEP.Base = “garrysfield_base”
SWEP.Category = “GarrysField 2”

SWEP.Spawnable = true
SWEP.AdminSpawnable = true

SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false

SWEP.ViewModel = “models/weapons/v_pist_usp.mdl”
SWEP.WorldModel = “models/weapons/w_pist_usp.mdl”

SWEP.Primary.Sound = Sound(“Weapon_USP.SilencedShot”)
SWEP.Primary.Damage = 20
SWEP.Primary.Recoil = 1
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.0155
SWEP.Primary.ClipSize = 12
SWEP.Primary.Delay = 0.16
SWEP.Primary.DefaultClip = 12
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = “pistol”

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”

SWEP.IronSightsPos = Vector( 5.15, -2, 2.6 )

function SWEP:Think()



function SWEP:Deploy()


self.Reloadaftershoot = CurTime() + 1


self.Weapon:SetNextPrimaryFire(CurTime() + 1)

return true


function SWEP:Reload()

if ( self.Reloadaftershoot > CurTime() ) then return end 


if ( self.Weapon:Clip1() < self.Primary.ClipSize ) and self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then

	self.Owner:SetFOV( 0, 0.15 )




function SWEP:PrimaryAttack()

if not self:CanPrimaryAttack() or self.Owner:WaterLevel() > 2 then return end

self.Reloadaftershoot = CurTime() + self.Primary.Delay

self.Weapon:SetNextSecondaryFire(CurTime() + self.Primary.Delay)

self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)




if ((SinglePlayer() and SERVER) or CLIENT) then
	self.Weapon:SetNetworkedFloat("LastShootTime", CurTime())


function SWEP:CSShootBullet(dmg, recoil, numbul, cone)

numbul 		= numbul or 1
cone 		= cone or 0.01

local bullet 	= {}
bullet.Num  	= numbul
bullet.Src 		= self.Owner:GetShootPos()       					-- Source
bullet.Dir 		= self.Owner:GetAimVector()      					-- Dir of bullet
bullet.Spread 	= Vector(cone, cone, 0)     						-- Aim Cone
bullet.Tracer 	= 1       									-- Show a tracer on every x bullets
bullet.Force 	= 0.5 * dmg     								-- Amount of force to give to phys objects
bullet.Damage 	= dmg										-- Amount of damage to give to the bullets

self.Owner:FireBullets(bullet)					-- Fire the bullets
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK_SILENCED)      	-- View model animation
self.Owner:MuzzleFlash()        					-- Crappy muzzle light

self.Owner:SetAnimation(PLAYER_ATTACK1)       			-- 3rd Person Animation

if ((SinglePlayer() and SERVER) or (not SinglePlayer() and CLIENT)) then
	local eyeang = self.Owner:EyeAngles()
	eyeang.pitch = eyeang.pitch - recoil


anyone? have any ideas?

The problem is because of your code in SWEP:Think(). It’s resetting the weapon’s animation dozens of times per second. That’s not how you want to make it use the silenced idle animation - it should do that automatically if you make it deploy, fire, or reload silenced. Also, it’s probably a bad idea to make it run IronSight() on itself that many times.

Just remove SWEP:Think() or comment it out with a multi-line comment (–[[ commented code ]] ) and the animations should work perfectly.

Hi, I am Andres Kramack from http://www.cathybarryadultstore.com/.

It’s a ‘pleasure’ serving the public if you know what I mean and this message is

Here at Cathy Barry Adult Store, we offer a wide variety of dildos that come in all sizes from goblin-sized dicks to black-man draconic dicks. I know at Facepunch everyone loves good old dicks which is why I personally offer anyone with an association with Facepunch Forums a 50% discount code “DIL4FACEPUNCH”. Don’t forget, this offer lasts until the next Garry’s Mod update which we so much love.

Here are pictures of our products just for you!

Sponsored Images:



Got any questions? Visit my Steam Profile!