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?

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

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