Jump to content

Can anyone show me a proper way for setTimer


Hero192

Recommended Posts

Posted

Hey guys, I am asking for a proper way for usage setTimer on this function

I want to set the timer about 2 secs ( 2000miliseconds) but I failed

function onPlaySound() 
    local sound = playSound("file/sound.wav")  
    setSoundVolume(sound, 0.5)  
end 

Posted
function onPlaySound() 
    local sound = playSound("file/sound.wav")  
    setSoundVolume(sound, 0.5)  
end 
setTimer(onPlaySound, 2000, 0) 

This?

And now Aurora is back again, pm for more info.

Ex. Lead dev & L6 Staff at AUR, NGC, MTA RP & SAA.

Ex. Developer at Community of Social Gamers - CSG

Ex Founder of International Gaming Community - IGC and Union of Individual Players- UIP

9o6E8.png Ab-47

Posted
function onPlaySound() 
    local sound = playSound("file/sound.wav") 
    setSoundVolume(sound, 0.5) 
    setTimer ( function() 
        stopSound(sound) 
    end, 2000, 1) 
end 

EDIT. This is to stop after 2000 ms, example above will start after 2000 ms

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

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