• Weapon Sound Gitch
    6 replies, posted
Hi I have a sniper sound that when I put it in the code it will not play the sound. Please help. Here is the code: [CODE]if SERVER then AddCSLuaFile( "shared.lua" ) resource.AddFile("sound//ttt/primaryfire1.wav"); resource.AddFile("sound/AfterRoundMusic/zeph-omen-v00.mp3"); resource.AddFile("sound/AfterRoundMusic/tobias-omen.m4a"); resource.AddFile("sound/AfterRoundMusic/HBFSRemix.wav"); resource.AddFile("sound/AfterRoundMusic/zeph-americanbadass-v00.mp3"); resource.AddFile("sound/AfterRoundMusic/tobias-blackbetty-v00.mp3"); resource.AddFile("sound/AfterRoundMusic/zeph-burn-v00.mp3"); resource.AddFile("sound/AfterRoundMusic/zeph-bitchcameback-v00.mp3"); resource.AddFile("sound/AfterRoundMusic/zeph-highwaytohell-v00.mp3") end SWEP.HoldType = "ar2" if CLIENT then SWEP.PrintName = "rifle_name" SWEP.Slot = 2 SWEP.Icon = "VGUI/ttt/icon_scout" end SWEP.Base = "weapon_tttbase" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.Kind = WEAPON_HEAVY SWEP.WeaponID = AMMO_RIFLE SWEP.Primary.Delay = 1.5 SWEP.Primary.Recoil = 7 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "357" SWEP.Primary.Damage = 50 SWEP.Primary.Cone = 0.005 SWEP.Primary.ClipSize = 10 SWEP.Primary.ClipMax = 20 -- keep mirrored to ammo SWEP.Primary.DefaultClip = 10 SWEP.HeadshotMultiplier = 4 SWEP.AutoSpawnable = true SWEP.AmmoEnt = "item_ammo_357_ttt" SWEP.ViewModel = Model("models/weapons/v_snip_scout.mdl") SWEP.WorldModel = Model("models/weapons/w_snip_scout.mdl") SWEP.Primary.Sound = Sound( "ttt/primaryfire.wav" ) SWEP.Secondary.Sound = Sound("Default.Zoom") SWEP.IronSightsPos = Vector( 5, -15, -2 ) SWEP.IronSightsAng = Vector( 2.6, 1.37, 3.5 ) function SWEP:SetZoom(state) if CLIENT then return else if state then self.Owner:SetFOV(20, 0.3) else self.Owner:SetFOV(0, 0.2) end end end -- Add some zoom to ironsights for this gun function SWEP:SecondaryAttack() if not self.IronSightsPos then return end if self.Weapon:GetNextSecondaryFire() > CurTime() then return end bIronsights = not self:GetIronsights() self:SetIronsights( bIronsights ) if SERVER then self:SetZoom(bIronsights) else self:EmitSound(self.Secondary.Sound) end self.Weapon:SetNextSecondaryFire( CurTime() + 0.3) end function SWEP:PreDrop() self:SetZoom(false) self:SetIronsights(false) return self.BaseClass.PreDrop(self) end function SWEP:Reload() self.Weapon:DefaultReload( ACT_VM_RELOAD ); self:SetIronsights( false ) self:SetZoom(false) end function SWEP:Holster() self:SetIronsights(false) self:SetZoom(false) return true end if CLIENT then local scope = surface.GetTextureID("sprites/scope") function SWEP:DrawHUD() if self:GetIronsights() then surface.SetDrawColor( 0, 0, 0, 255 ) local x = ScrW() / 2.0 local y = ScrH() / 2.0 local scope_size = ScrH() -- crosshair local gap = 80 local length = scope_size surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) gap = 0 length = 50 surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) -- cover edges local sh = scope_size / 2 local w = (x - sh) + 2 surface.DrawRect(0, 0, w, scope_size) surface.DrawRect(x + sh - 2, 0, w, scope_size) surface.SetDrawColor(255, 0, 0, 255) surface.DrawLine(x, y, x + 1, y + 1) -- scope surface.SetTexture(scope) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRectRotated(x, y, scope_size, scope_size, 0) else return self.BaseClass.DrawHUD(self) end end function SWEP:AdjustMouseSensitivity() return (self:GetIronsights() and 0.2) or nil end end[/CODE] The error is that the sound is missing from the server, it is defiantly there though.
You have two slashes resource.AddFile("sound//ttt/primaryfire1.wav");
I tried that and it still did didn't do it
Is there anything inside the console when you try firing the gun?
Yes, it says that the sou d is missing from the spot, but I have almost all my custom gun noises there and they work. [editline]19th April 2013[/editline] Here is the exact error [QUOTE]Failed to load sound "\tet\primaryfire1.wav", file probably missing from disk/repository[/QUOTE]
\tet\? If you moved the sound you have to change all the filepaths?
I did, it still doesn't work
Sorry, you need to Log In to post a reply to this thread.