Jump to content

Original Sound Effects


ThePCGuy

Recommended Posts

Posted

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.

Posted (edited)
numberOfGroups = { 5, 4 } 
setWorldSoundEnabled ( numberOfGroups [ ( #numberOfGroups ) ], false ) 

Edited by Guest
Posted

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 
) 

Posted (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 by Guest
Posted
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.

Posted

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?

Posted

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.

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...