• TTT Server - No gunshot sounds!
    19 replies, posted
My problem on my Server is that since the updates you cannot hear other gunshots. Only when you shoot yourself. Other shots are silent. No lua errors help?
It's an issue with soundscapes. It will be fixed in the next update.
... But its somehow only on my server... and some weapons like the scout work and the deagle do not work..
You're not the only one. Some other servers have it fixed because they are probably still using the old weapons system.
ah ok.. I hope it will get fixed soon becuase it annoying
How can I reenable the old weapon sytem? because it is really annoying [editline]19th April 2014[/editline] BTW. there is another problem : themagneto stick will not work either.. or it only pushes and will not pick up
[QUOTE=theonedowny;44586199]How can I reenable the old weapon sytem? because it is really annoying [editline]19th April 2014[/editline] BTW. there is another problem : themagneto stick will not work either.. or it only pushes and will not pick up[/QUOTE] You can't if you updated. As for the magneto stick, I am having no issues with it. Make sure you're picking up a prop that is light enough.
Well i can not pick up weapons neither corpses so they should be light enough -> i have a vanilla ttt server and it will not work there either
You have some addon modifying it then; I do all my testing on a vanilla TTT server so it's obviously something on your end.
I found out what the bug is : [CODE]SWEP.Primary.Sound = Sound( "Weapon_AK47.Single" )[/CODE] does not work [CODE]SWEP.Primary.Sound = Sound(")weapons/ak47/ak47-1.wav" )[/CODE] works but at constant rate bugs too for 3 shots
[QUOTE=theonedowny;44600653]I found out what the bug is : [CODE]SWEP.Primary.Sound = Sound( "Weapon_AK47.Single" )[/CODE] does not work [CODE]SWEP.Primary.Sound = Sound(")weapons/ak47/ak47-1.wav" )[/CODE] works but at constant rate bugs too for 3 shots[/QUOTE] You shouldn't have that extra parenthesis there. The reason "Weapon_AK47.Single" doesn't work is because soundscapes are currently broken. They'll be fixed in the next update.
So the last bug is the magneto stick... I think this code is not broken for weapon_zm_carry.lua : [CODE] ---- Carry weapon SWEP AddCSLuaFile() SWEP.HoldType = "pistol" if CLIENT then SWEP.PrintName = "magnet_name" SWEP.Slot = 4 end SWEP.Base = "weapon_tttbase" SWEP.AutoSpawnable = false SWEP.ViewModel = Model("models/weapons/v_stunbaton.mdl") SWEP.WorldModel = Model("models/weapons/w_stunbaton.mdl") SWEP.DrawCrosshair = false SWEP.ViewModelFlip = false SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "none" SWEP.Primary.Delay = 0.1 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" SWEP.Secondary.Delay = 0.1 SWEP.Kind = WEAPON_CARRY SWEP.InLoadoutFor = {ROLE_INNOCENT, ROLE_TRAITOR, ROLE_DETECTIVE} SWEP.AllowDelete = false SWEP.AllowDrop = false SWEP.NoSights = true SWEP.EntHolding = nil SWEP.CarryHack = nil SWEP.Constr = nil SWEP.PrevOwner = nil local allow_rag = CreateConVar("ttt_ragdoll_carrying", "1") local prop_force = CreateConVar("ttt_prop_carrying_force", "60000") local no_throw = CreateConVar("ttt_no_prop_throwing", "0") local pin_rag = CreateConVar("ttt_ragdoll_pinning", "1") local pin_rag_inno = CreateConVar("ttt_ragdoll_pinning_innocents", "0") -- Allowing weapon pickups can allow players to cause a crash in the physics -- system (ie. not fixable). Tuning the range seems to make this more -- difficult. Not sure why. It's that kind of crash. local allow_wep = CreateConVar("ttt_weapon_carrying", "1") local wep_range = CreateConVar("ttt_weapon_carrying_range", "50") -- not customizable via convars as some objects rely on not being carryable for -- gameplay purposes CARRY_WEIGHT_LIMIT = 45 local PIN_RAG_RANGE = 90 local player = player local IsValid = IsValid local CurTime = CurTime local function SetSubPhysMotionEnabled(ent, enable) if not IsValid(ent) then return end for i=0, ent:GetPhysicsObjectCount()-1 do local subphys = ent:GetPhysicsObjectNum(i) if IsValid(subphys) then subphys:EnableMotion(enable) if enable then subphys:Wake() end end end end local function KillVelocity(ent) ent:SetVelocity(vector_origin) -- The only truly effective way to prevent all kinds of velocity and -- inertia is motion disabling the entire ragdoll for a tick -- for non-ragdolls this will do the same for their single physobj SetSubPhysMotionEnabled(ent, false) timer.Simple(0, function() SetSubPhysMotionEnabled(ent, true) end) end function SWEP:Reset(keep_velocity) if IsValid(self.CarryHack) then self.CarryHack:Remove() end if IsValid(self.Constr) then self.Constr:Remove() end if IsValid(self.EntHolding) then if not IsValid(self.PrevOwner) then self.EntHolding:SetOwner(nil) else self.EntHolding:SetOwner(self.PrevOwner) end -- the below ought to be unified with self:Drop() local phys = self.EntHolding:GetPhysicsObject() if IsValid(phys) then phys:ClearGameFlag(FVPHYSICS_PLAYER_HELD) phys:AddGameFlag(FVPHYSICS_WAS_THROWN) phys:EnableCollisions(true) phys:EnableGravity(true) phys:EnableDrag(true) phys:EnableMotion(true) end if (not keep_velocity) and (no_throw:GetBool() or self.EntHolding:GetClass() == "prop_ragdoll") then KillVelocity(self.EntHolding) end end self.dt.carried_rag = nil self.EntHolding = nil self.CarryHack = nil self.Constr = nil end SWEP.reset = SWEP.Reset function SWEP:CheckValidity() if (not IsValid(self.EntHolding)) or (not IsValid(self.CarryHack)) or (not IsValid(self.Constr)) then -- if one of them is not valid but another is non-nil... if (self.EntHolding or self.CarryHack or self.Constr) then self:Reset() end return false else return true end end local function PlayerStandsOn(ent) for _, ply in pairs(player.GetAll()) do if ply:GetGroundEntity() == ent and ply:IsTerror() then return true end end return false end if SERVER then local ent_diff = vector_origin local ent_diff_time = CurTime() local stand_time = 0 function SWEP:Think() if not self:CheckValidity() then return end -- If we are too far from our object, force a drop. To avoid doing this -- vector math extremely often (esp. when everyone is carrying something) -- even though the occurrence is very rare, limited to once per -- second. This should be plenty to catch the rare glitcher. if CurTime() > ent_diff_time then ent_diff = self:GetPos() - self.EntHolding:GetPos() if ent_diff:Dot(ent_diff) > 40000 then self:Reset() return end ent_diff_time = CurTime() + 1 end if CurTime() > stand_time then if PlayerStandsOn(self.EntHolding) then self:Reset() return end stand_time = CurTime() + 0.1 end self.CarryHack:SetPos(self.Owner:EyePos() + self.Owner:GetAimVector() * 70) self.CarryHack:SetAngles(self.Owner:GetAngles()) self.EntHolding:PhysWake() end end function SWEP:PrimaryAttack() self:DoAttack(false) end function SWEP:SecondaryAttack() self:DoAttack(true) end function SWEP:MoveObject(phys, pdir, maxforce, is_ragdoll) if not IsValid(phys) then return end local speed = phys:GetVelocity():Length() -- remap speed from 0 -> 125 to force 1 -> 4000 local force = maxforce + (1 - maxforce) * (speed / 125) if is_ragdoll then force = force * 2 end pdir = pdir * force local mass = phys:GetMass() -- scale more for light objects if mass < 50 then pdir = pdir * (mass + 0.5) * (1 / 50) end phys:ApplyForceCenter(pdir) end function SWEP:GetRange(target) if IsValid(target) and target:IsWeapon() and allow_wep:GetBool() then return wep_range:GetFloat() elseif IsValid(target) and target:GetClass() == "prop_ragdoll" then return 75 else return 100 end end function SWEP:AllowPickup(target) local phys = target:GetPhysicsObject() local ply = self:GetOwner() return (IsValid(phys) and IsValid(ply) and (not phys:HasGameFlag(FVPHYSICS_NO_PLAYER_PICKUP)) and phys:GetMass() < CARRY_WEIGHT_LIMIT and (not PlayerStandsOn(target)) and (target.CanPickup != false) and (target:GetClass() != "prop_ragdoll" or allow_rag:GetBool()) and ((not target:IsWeapon()) or allow_wep:GetBool())) end function SWEP:DoAttack(pickup) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay ) if IsValid(self.EntHolding) then self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) if (not pickup) and self.EntHolding:GetClass() == "prop_ragdoll" then -- see if we can pin this ragdoll to a wall in front of us if not self:PinRagdoll() then -- else just drop it as usual self:Drop() end else self:Drop() end self.Weapon:SetNextSecondaryFire(CurTime() + 0.3) return end local ply = self.Owner local trace = ply:GetEyeTrace(MASK_SHOT) if IsValid(trace.Entity) then local ent = trace.Entity local phys = trace.Entity:GetPhysicsObject() if not IsValid(phys) or not phys:IsMoveable() or phys:HasGameFlag(FVPHYSICS_PLAYER_HELD) then return end -- if we let the client mess with physics, desync ensues if CLIENT then return end if pickup then if (ply:EyePos() - trace.HitPos):Length() < self:GetRange(ent) then if self:Allow
Seems working [code] local repsound = { -- got from neoru4 ["weapon_g3sg1.single"] = "weapons/g3sg1/g3sg1-1.wav", ["weapon_glock.single"] = "weapons/glock/glock18-1.wav", ["weapon_galil.single"] = "weapons/galil/galil-1.wav", ["weapon_m249.single"] = "weapons/m249/m249-1.wav", ["weapon_xm1014.single"] = "weapons/xm1014/xm1014-1.wav", ["weapon_m3.single"] = "weapons/m3/m3-1.wav", ["weapon_mac10.single"] = "weapons/mac10/mac10-1.wav", ["weapon_tmp.single"] = "weapons/tmp/tmp-1.wav", ["weapon_mp5navy.single"] = "weapons/mp5navy/mp5-1.wav", ["weapon_p228.single"] = "weapons/p228/p228-1.wav", ["weapon_p90.single"] = "weapons/p90/p90-1.wav", ["weapon_scout.single"] = "weapons/scout/scout_fire-1.wav", ["weapon_sg550.single"] = "weapons/sg550/sg550-1.wav", ["weapon_sg552.single"] = "weapons/sg552/sg552-1.wav", ["weapon_fiveseven.single"] = "weapons/fiveseven/fiveseven-1.wav", ["weapon_ump45.single"] = "weapons/ump45/ump45-1.wav", ["weapon_usp.silencedshot"] = "weapons/usp/usp1.wav", ["weapon_usp.single"] = "weapons/usp/usp_unsil-1.wav", ["weapon_m4a1.single"] = "weapons/m4a1/m4a1_unsil-1.wav", ["weapon_m4a1.silenced"] = "weapons/m4a1/m4a1-1.wav", ["weapon_elite.single"] = "weapons/elite/elite-1.wav", ["weapon_famas.single"] = "weapons/famas/famas-1.wav", ["weapon_aug.single"] = "weapons/aug/aug-1.wav", ["weapon_awp.single"] = "weapons/awp/awp1.wav", ["weapon_deagle.single"] = "weapons/DEagle/deagle-1.wav", ["weapon_ak47.single"] = "weapons/ak47/ak47-1.wav", } -- right way to hook a function -- if runned twice will not make a hook-loop -- run "Sound = Sound_old" to unhook if not Sound_old then Sound_old = Sound end function Sound(a,...) if repsound[a:lower()] then return Sound_old(repsound[a:lower()],...) end -- you can add a logger for sound names without .wav or starting from weapon_, if you want return Sound_old(a,...) end [/code]
Make sure you don't have any scripts in the scripts folder, they can cause this bug.
[QUOTE=Sanya_Zol;44839868]Seems working -snip-[/quote] That will cause major issues since you are overwriting manifests.
[QUOTE=code_gs;44840816]That will cause major issues since you are overwriting manifests.[/QUOTE] of cource it will. use at your own risk. but is there another way without rewriting tons of sweps? afaik, it can conflict [B]only with badly-written scripts[/B] 1) it can (but should not) conflict with another Sound() rewrites 2) Sound('weapon_ak47.single') will return 'weapons/ak47/ak47-1.wav' in this case it will be OK: [code] local s = Sound('weapon_ak47.single') ... someEntity:EmitSound(s) [/code] in this case it will fail: [code] local s = Sound('weapon_ak47.single') ... someEntity:EmitSound('weapon_ak47.single') [/code]
There's this hook: [url]http://wiki.garrysmod.com/page/GM/EntityEmitSound[/url] I am not sure whether it will be called in this case ( Since I can't reproduce ), but it might be a better solution than detouring a function.
[QUOTE=Robotboy655;44840985]There's this hook: [url]http://wiki.garrysmod.com/page/GM/EntityEmitSound[/url] I am not sure whether it will be called in this case ( Since I can't reproduce ), but it might be a better solution than detouring a function.[/QUOTE] Entity(1):EmitSound('Weapon_AK47.Single') It does not work serverside, cliendside EmitSound is OK. Since that's gmod bug, I hope it will be fixed soon.
Yes it does. [IMG]http://i.imgur.com/bENIIF1.png[/IMG]
[QUOTE=Robotboy655;44841409]Yes it does. [IMG]http://i.imgur.com/bENIIF1.png[/IMG][/QUOTE] i was wrong about a hook now i started gmod again to check this out, and serverside Entity(1):EmitSound('Weapon_AK47.Single') is working now. wtf.
Sorry, you need to Log In to post a reply to this thread.