ThePCGuy Posted January 23, 2013 Posted January 23, 2013 Can those be disabled? Since i am using seperate gun sound effects ingame, its ennoying to hear both effects at the same time. EDIT: I searched more about this and found this page: https://wiki.multitheftauto.com/wiki/Set ... ectEnabled But how i am supposed to know the name of the sound element ?
Castillo Posted January 23, 2013 Posted January 23, 2013 That function is used to set a sound ELEMENT effect state, I think that you can't disable weapon sounds.
ThePCGuy Posted January 24, 2013 Author Posted January 24, 2013 That's the ambient not the single shots that ''you'' fire yourself.
ThePCGuy Posted January 24, 2013 Author Posted January 24, 2013 Yes! It worked. Awesome man, thanks I had to use a upgrade on my resource tho
ThePCGuy Posted January 24, 2013 Author Posted January 24, 2013 A other question, how can i make a list of groups so it fetches it from there instead of doing this: setWorldSoundEnabled( 5, false ) setWorldSoundEnabled( 5, 31, true ) setWorldSoundEnabled( 5, 32, true ) But doing like: numberOfGroups = { {5}, {4}} setWorldSoundEnabled( numberOfGroups, false ) I know its totally wrong but i dont know how to do something like that since i am new to scripting.
Vision Posted January 24, 2013 Posted January 24, 2013 (edited) numberOfGroups = { 5, 4 } setWorldSoundEnabled ( numberOfGroups [ ( #numberOfGroups ) ], false ) Edited January 24, 2013 by Guest
ThePCGuy Posted January 24, 2013 Author Posted January 24, 2013 Why is this not working ? local numberOfGroups = { 5, 3 } local numberOfIndex = { 5, 4, 3, 53, 14, 33 } addEventHandler("onClientResourceStart", resourceRoot, function() setWorldSoundEnabled ( #numberOfGroups, #numberOfIndex, false ) setDevelopmentMode (true) end end )
Vision Posted January 24, 2013 Posted January 24, 2013 (edited) I did a mistake on code, my bad, but now I fixed it. local numberOfGroups = { 5, 3 } local numberOfIndex = { 5, 4, 3, 53, 14, 33 } addEventHandler("onClientResourceStart", resourceRoot, function() setWorldSoundEnabled ( numberOfGroups [ ( #numberOfGroups ) ], numberOfIndex [ ( #numberOfIndex ) ], false ) setDevelopmentMode (true) end ) Edited January 24, 2013 by Guest
ThePCGuy Posted January 24, 2013 Author Posted January 24, 2013 Still, the sound effects that i disabled with this code are still enabled.
ThePCGuy Posted January 24, 2013 Author Posted January 24, 2013 Copy my code again Tried again with no results.
Castillo Posted January 24, 2013 Posted January 24, 2013 local numberOfIndex = { 5, 4, 3, 53, 14, 33 } addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) for _, index in ipairs ( numberOfIndex ) do setWorldSoundEnabled ( 3, index, false ) setWorldSoundEnabled ( 5, index, false ) end setDevelopmentMode ( true ) end ) Try it.
ThePCGuy Posted January 24, 2013 Author Posted January 24, 2013 Great! Works now. One thing about your fix, my goal was to not have multiple lines with ''setWorldSoundEnabled'' wich you did for the group (3, 5) Is it possible to do the same as with the index?
Castillo Posted January 24, 2013 Posted January 24, 2013 Yes, but it won't make any difference, in fact, it'll be longer script.
ThePCGuy Posted January 24, 2013 Author Posted January 24, 2013 Oh well. Thanks for your help then, as i am new to scripting can you explain me this: for _, index in ipairs ( numberOfIndex ) do Its nice that someone else is does it for me, but i need to learn myself certain functions etcetra also.
Castillo Posted January 24, 2013 Posted January 24, 2013 That's a for-loop, used to loop all items in the "numberOfIndex" table. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now