local wcr_mufflesounds = CreateConVar("wcr_mufflesounds", 1, FCVAR_ARCHIVE)

local local_ply
hook.Add("Think", "WCR_SoundMuffler", function()
	if vcmod1 != nil then return end
	local_ply = local_ply or LocalPlayer()
	local lveh = local_ply:GetVehicle()
	local muffled = wcr.SoundMuffled
	local shouldbemuffled = IsValid(lveh) and IsValid(lveh:WCR_GetCarEntity()) and wcr_mufflesounds:GetBool()
	if muffled != shouldbemuffled then
		LocalPlayer():SetDSP(shouldbemuffled and 31 or 0, false)
		wcr.SoundMuffled = shouldbemuffled
	end
end)