Sounds are cutting off every few shots

So I’m recoding M9K’s weapons for TTT.

They work superbly except for one issue:

I’d fire off in a quick succession like 10 bullets.

They all fire off.

The sound for the first 3 or 4 are played, but the next 6 or 7 do not play. Then the next 3 or 4 play then the gun reloads.

A good number of people on the server have this issue. What can I do to fix this issue for everyone?

I took the advantage of Resource.Addworkshop and the steam API collection adding, so editing sounds is sadly out of the question.
Is there a fix for this? I really would like help on this! Thank you!

If fixing it yourself is out of the question, you should contact the creator of the pack to fix it. Posting it here wont help you, unless you want to fix it yourself.

Is the gun emitting .wav files directly or using sound scripts? If you’re using wav files then I’m pretty sure there’s a limited amount of free channels each entity has. Sound scripts get around this by assigning predefined channels. You fire a shot and then fire another. The second shot’s sound overrides the first so you only ever hear one round.

You can make sound scripts with pure Lua by using sound.Add

well im coding the TTT weapons themselves. the sounds and models are from a addon from workshop.

Here’s the code with a glock:


if SERVER then
AddCSLuaFile( “shared.lua” )
end

SWEP.HoldType = “pistol”

if CLIENT then
SWEP.PrintName = “Glock 18”
SWEP.Slot = 1

SWEP.Icon = “materials/vgui/hud/glock.vtf”
end

SWEP.Kind = WEAPON_PISTOL
SWEP.WeaponID = AMMO_GLOCK

SWEP.Base = “weapon_tttbase”
SWEP.Primary.Recoil = 0.9
SWEP.Primary.Damage = 12
SWEP.Primary.Delay = 0.10
SWEP.Primary.Cone = 0.028
SWEP.Primary.ClipSize = 20
SWEP.Primary.Automatic = true
SWEP.Primary.DefaultClip = 20
SWEP.Primary.ClipMax = 60
SWEP.Primary.Ammo = “Pistol”
SWEP.AutoSpawnable = true
SWEP.AmmoEnt = “item_ammo_pistol_ttt”

SWEP.UseHands = true
SWEP.ViewModelFlip = true
SWEP.ViewModelFOV = 54
SWEP.ViewModel = “models/weapons/v_dmg_glock.mdl”
SWEP.WorldModel = “models/weapons/w_dmg_glock.mdl”

SWEP.Primary.Sound = Sound( “weapons/dmg_glock/mac10-1.wav” )
SWEP.IronSightsPos = Vector (2.2042, 0, 1.7661)

SWEP.HeadshotMultiplier = 1.75


The issue with this gun (and MANY others) is that the first 3 or 4 shots have sound. Then it doesnt play any sound from the gun for the next 5 or 6 shots, then it repeats the process. I’m trying to figure out how to fix that issue, because everyone on my TTT server gets this issue.

If it helps the code is taken from the default TTT weapons, with the proper sound, model, ironsights, and everything correctly modifed, and installed with M9K’s weapon packs.

SWEP.Primary.Sound = Sound( “Weapon_Mac10.Single” )

Or something like that, I don’t remember the exact name.

this is using a different sound then the CSS’s mac 10, though.

JetBoom was actually kind enough to help me out not too long ago when I was having this problem.

First you create the sound you want to use. Add this code to the top of your SWEP’s shared.lua:


sound.Add(
{
    name = "Weapon_Winchester.Fire",
    channel = CHAN_WEAPON,
    volume = 1.0,
    soundlevel = 100,
    pitchstart = 95,
    pitchend = 105,
    sound = "weapons/m3-3.wav"
})

Then you can use the sound:


SWEP.Primary.Sound = Sound( "Weapon_Winchester.Fire" )

so I have to go in to each and every one of my guns, and add this:

sound.Add(
{
name = “Soundname.fire”,
channel = CHAN_WEAPON,
volume = 1.0,
soundlevel = 100,
pitchstart = 95,
pitchend = 105,
sound = “weapons/filepath”
})

and then for the sound.fire or whatever it’s called I set it to soundname.fire?

And this will fix the issue with guns skipping over sounds?

Yep, you are correct.

I see this a lot. People tend to release popular stuff on the workshop with broken sounds… “Customizable Weaponry” is one.

well TTT M9K’s might be an addition that isnt freaking broken…

[editline]9th July 2013[/editline]

Also, does that first script go above the resource.addfile shared.lua, or after it?

[editline]9th July 2013[/editline]

nevermind, figured it out