Help with reload sounds



if (SERVER) then
	AddCSLuaFile("shared.lua")
	SWEP.HoldType 		= "ar2"
end

if (CLIENT) then
	SWEP.PrintName 		= "Barrett M82A1"
	SWEP.ViewModelFOV		= 60
	SWEP.Slot 			= 3
	SWEP.SlotPos 		= 1
	SWEP.IconLetter 		= "r"

	killicon.AddFont("weapon_awp", "CSKillIcons", SWEP.IconLetter, Color( 255, 0, 0, 255 ) )
end

SWEP.Instructions 		= "Hold your use key and press secondary fire to change fire modes."
SWEP.Author				= "SKYTOP1234"
SWEP.Contact			= "xx.skytop.xx@gmail.com"

SWEP.Base 				= "weapon_mad_base_sniper"

SWEP.ViewModelFlip		= true
SWEP.Spawnable 			= true
SWEP.AdminSpawnable 		= false
SWEP.Category			= "SKYTOPs Snipers"
SWEP.ViewModel				= "models/weapons/v_snip_m82.mdl"
SWEP.WorldModel				= "models/weapons/w_snip_m82.mdl"

SWEP.Primary.Sound			= Sound("weapons/m82/m82.wav")
SWEP.Primary.Reload			= Sound("weapons/m82/reload.wav")

SWEP.Primary.Damage 		= 95
SWEP.Primary.Recoil 		= 15
SWEP.Primary.NumShots 		= 1
SWEP.Primary.Cone 		= 0.0012
SWEP.Primary.ClipSize 		= 10
SWEP.Primary.Delay 		= 0.68
SWEP.Primary.DefaultClip 	= 30
SWEP.Primary.Automatic 		= false
SWEP.Primary.Ammo 		= "StriderMinigun"

SWEP.IronSightZoom 			= 1.8
SWEP.ScopeZooms				= {6}


SWEP.Secondary.ClipSize		= -1					// Size of a clip
SWEP.Secondary.DefaultClip	= -1					// Default number of bullets in a clip
SWEP.Secondary.Automatic	= false				// Automatic/Semi Auto
SWEP.Secondary.Ammo		= "none"

SWEP.ShellEffect			= "effect_mad_shell_rifle"	// "effect_mad_shell_pistol" or "effect_mad_shell_rifle" or "effect_mad_shell_shotgun"
SWEP.ShellDelay			= 0.1

SWEP.IronSightsPos = Vector (0.9779, -29.4471, 0.0766)
SWEP.IronSightsAng = Vector (-0.8411, 9.9905, 0)


SWEP.ScopeZooms			= {12}

SWEP.BoltActionSniper		= false

/*---------------------------------------------------------
   Name: SWEP:Precache()
   Desc: Use this function to precache stuff.
---------------------------------------------------------*/
function SWEP:Precache()

    	util.PrecacheSound("weapons/m82/m82.wav")
		util.PrecacheSound("weapons/m82/reload.wav")
end


I have the sounds set up in the correct position. The firing sounds work just fine put when I go to reload the weapon the sound doesn’t play. What am I doing wrong. Note this is a mad cow base.

I’m bumping this because i have the same problem.:v:

Got it working myself. Put this somewhere in your code.


[lua]function SWEP:Reload() 

if self:Ammo1() > 0 and self.Weapon:Clip1() < self.Primary.ClipSize then
self.Weapon:DefaultReload(ACT_VM_RELOAD);
self.Weapon:EmitSound("weapons/m82/reload.wav")
end 

end[/lua]

#meganecropost

Well, I have the same problem, but in /m82/ I have sounds for boltup boltdown clipin and clipout.
How would I get these to work?

[lua]
timer.Simple(0.4, function()
if not IsValid(self.Owner) or self.Owner:GetActiveWeapon() == self.Weapon then
return false end
self.Weapon:EmitSound(soundpathgoeshere)
end)
[/lua]

fiddle around with the timer number and change soundpathgoeshere to the sound you want
and put it once for each sound in your reload function

Didn’t work.
I get no reload sounds, and now the “Weapon_Pistol.Empty” doesn’t play when I dry fire.
And, no console errors, may I add.

Edit: Reduced it to one timer, the sound still doesn’t work, but the Weapon_Pistole.Empty plays when I dry fire now.

B’dump, need this soon.