• Swep gunshot sound help
    1 replies, posted
Hello there everyone, I have successfully created my first Swep, although once I uploaded it to a server I have been running into some issues considering the gunshot sound. I followed this [URL="http://murderthon9000.com/bobs-base/"]tutorial[/URL] for creating the Swep. Now to my issue: Sometimes you cannot hear shots at all or the sound is delayed! So I assume the gunshot sounds are not properly precached? autorun.lua from bobs base: [CODE] sound.Add({ name = "wep_ass_shot", channel = CHAN_USER_BASE+10, --see how this is a different channel? Gunshots go here volume = 1.0, sound = { "sound/weapons/wep_ass/m4a1_unsil-1.wav", "sound/weapons/wep_ass/m4a1_unsil-2.wav" } }) [/CODE] shared.lua from the gunbase (just the precaching): [CODE] function SWEP:Precache() util.PrecacheSound(self.Primary.Sound) util.PrecacheModel(self.ViewModel) util.PrecacheModel(self.WorldModel) end [/CODE] And finally the full code of the Sweps shared.lua: [CODE] -- Variables that are used on both client and server SWEP.Gun = ("wep_ass1") -- must be the name of your swep but NO CAPITALS! SWEP.Category = "Lua Beispiele" --Category where you will find your weapons SWEP.Author = "" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.PrintName = "Assault Rifle" -- Weapon name (Shown on HUD) SWEP.Slot = 2 -- Slot in the weapon selection menu SWEP.SlotPos = 3 -- Position in the slot SWEP.DrawAmmo = true -- Should draw the default HL2 ammo counter SWEP.DrawWeaponInfoBox = false -- Should draw the weapon info box SWEP.BounceWeaponIcon = false -- Should the weapon icon bounce? SWEP.DrawCrosshair = false -- set false if you want no crosshair SWEP.Weight = 30 -- rank relative ot other weapons. bigger is better SWEP.AutoSwitchTo = true -- Auto switch to if we pick it up SWEP.AutoSwitchFrom = true -- Auto switch from if you pick up a better weapon SWEP.HoldType = "ar2" -- how others view you carrying the weapon -- normal melee melee2 fist knife smg ar2 pistol rpg physgun grenade shotgun crossbow slam passive -- you're mostly going to use ar2, smg, shotgun or pistol. rpg makes for good sniper rifles SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = true SWEP.ViewModel = "models/weapons/v_wep_ass1.mdl" -- Weapon view model SWEP.WorldModel = "models/weapons/w_smg1.mdl" -- Weapon world model SWEP.ShowWorldModel = false SWEP.Base = "avoid_gun_base" --the Base this weapon will work on. PLEASE RENAME THE BASE! SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.FiresUnderwater = false SWEP.Primary.Sound = Sound("wep_ass_shot") -- Script that calls the primary fire sound --SWEP.Primary.SilencedSound = Sound("wep_ass_silent") -- Sound if the weapon is silenced SWEP.Primary.RPM = 625 -- This is in Rounds Per Minute SWEP.Primary.ClipSize = 30 -- Size of a clip SWEP.Primary.DefaultClip = 60 -- Bullets you start with SWEP.Primary.KickUp = 0.4 -- Maximum up recoil (rise) SWEP.Primary.KickDown = 0.3 -- Maximum down recoil (skeet) SWEP.Primary.KickHorizontal = 0.3 -- Maximum up recoil (stock) SWEP.Primary.Automatic = true -- Automatic = true; Semi Auto = false SWEP.Primary.Ammo = "ar2" -- pistol, 357, smg1, ar2, buckshot, slam, SniperPenetratedRound, AirboatGun -- Pistol, buckshot, and slam always ricochet. --Use AirboatGun for a light metal peircing shotgun pellets SWEP.SelectiveFire = true SWEP.CanBeSilenced = false SWEP.Secondary.IronFOV = 55 -- How much you 'zoom' in. Less is more! SWEP.data = {} --The starting firemode SWEP.data.ironsights = 1 SWEP.Primary.Damage = 30 -- Base damage per bullet SWEP.Primary.Spread = .02 -- Define from-the-hip accuracy 1 is terrible, .0001 is exact) SWEP.Primary.IronAccuracy = .01 -- Ironsight accuracy, should be the same for shotguns -- Enter iron sight info and bone mod info below SWEP.IronSightsPos = Vector(4.94, -4.436, 1.269) SWEP.IronSightsAng = Vector(-0.071, 0.143, 0.003) SWEP.SightsPos = Vector (4.94, -4.436, 1.269) SWEP.SightsAng = Vector (-0.071, 0.143, 0.003) -- SWEP.RunSightsPos = Vector(-1.716, -4.837, 0.185) SWEP.RunSightsAng = Vector(-3.85, -56.753, -0.099) [/CODE] Thanks for reading, Avoidy
Try using CHAN_WEAPON.
Sorry, you need to Log In to post a reply to this thread.