boro Posted December 17, 2012 Share Posted December 17, 2012 Hi all, please help what is bad in this line ? setTimer(removeEventHandler,1 * 60 * 1000 ,1, "onPlaySound") Link to comment
Tete omar Posted December 17, 2012 Share Posted December 17, 2012 Are you sure that there an event called 'onPlaySound' ? Link to comment
boro Posted December 17, 2012 Author Share Posted December 17, 2012 yes function playSounds ( file,vol ) local sound = playSound( file ) --Play file from the resource folder setSoundVolume(sound, vol) -- set the sound volume to 100% end addEvent( "onPlaySound", true ) addEventHandler( "onPlaySound", getRootElement(), playSounds ) Link to comment
Tete omar Posted December 17, 2012 Share Posted December 17, 2012 setTimer(removeEventHandler,1 * 60 * 1000 ,1, "onPlaySound",playSounds) That should work. Link to comment
Renkon Posted December 17, 2012 Share Posted December 17, 2012 For some reason, setTimer fails sometimes, at least in my case when using eventHandler, evenmore when having arguments. Try this: setTimer(function() removeEventHandler("onPlaySound") end, 60000, 1) Link to comment
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