Jump to content

[HELP] setWorldSoundEnabled not working


Recommended Posts

Hello,

I'm trying to disable default weapon sounds, but it's not working.
I obtained the sounds with development mode + showsound and I turned them off, but ther are still there.
Not even the example on mtawiki works, or other codes that I found.
What's going on?! 

Thanks for reading!

Link to post
  • Moderators
11 minutes ago, Captain07 said:

What's going on?! 

Most gun sounds exist out of multiple small sounds. Maybe that is the issue?

  • Thanks 1
Link to post

Can you show your code please?

42 minutes ago, Captain07 said:

The weapon sounds are in group 5, and I disabled the whole group. Still, the sounds don't disappear. 🤨

Did you try the group ID 3?

  • Thanks 1
Link to post
33 minutes ago, Erlkonig said:

Can you show your code please?

Did you try the group ID 3?

function toggle()
    setWorldSoundEnabled(5, false) 
	setWorldSoundEnabled(3, false) 
end
addCommandHandler("toggle", toggle)

 

Link to post
7 hours ago, Captain07 said:

function toggle()
    setWorldSoundEnabled(5, false) 
	setWorldSoundEnabled(3, false) 
end
addCommandHandler("toggle", toggle)

 

Are you sure that this is the client-side?

  • Thanks 1
Link to post

It is in client side. I can disable other sounds, but not weapon sounds.

My only guess is that there is another resource that enables them. But I have no idea which, I don't even remember doing anything like this before. Is there a way to find out which resource uses this function, without checking them one by one?

Link to post
37 minutes ago, Captain07 said:

It is in client side. I can disable other sounds, but not weapon sounds.

My only guess is that there is another resource that enables them. But I have no idea which, I don't even remember doing anything like this before. Is there a way to find out which resource uses this function, without checking them one by one?

I tested this script, it works. Can you try to test it  the default MTA server?

  • Thanks 1
Link to post
22 minutes ago, Erlkonig said:

I tested this script, it works. Can you try to test it  the default MTA server?

Yup, it's working, I stopped everything else. Now I have to find out what is messing around, I guess this is where the fun begins. 😅
Thanks everyone!

  • Like 2
Link to post
11 minutes ago, Captain07 said:

Yup, it's working, I stopped everything else. 

and that's because you disabled a whole group, you need to find the index. anyway,

I have a code that disables most gunshots, M4/AK is still around here i think since i didn't want to disable the rustler/seasparrow sound...( but M4/AK sounds are not noticeable if it has a custom sound anyway..  unlike Deagle, etcs) what type of sounds do u want to disable? anyway here:

local removedIDs = { 33, 4, 28, 21, 22, 23, 6, 7, 8, 29, 30, 17, 18, 26,
27, 52, 53, 5, 0, 1, 2, 12, 14, 15, 16, 11 }

setWorldSoundEnabled ( 5,  true)
for i, sound in pairs(removedIDs) do
	setWorldSoundEnabled(5, sound, false)
end

Just play with it, see what IDs u wanna remove / add.

It's all weapon sounds btw.

Edited by Bean666
  • Thanks 1
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...