#RooTs Posted May 16, 2016 Share Posted May 16, 2016 Hello friends. how can I use this function to start and stop when I want? local sound = playSound3D("sounds/song.mp3", 373.14, -125.21, 1001, false) good. I imagine that I can use these functions local sound = playSound3D("sounds/song.mp3", 373.14, -125.21, 1001, false) function playMySound() playSound( sound ) end addCommandHandler ( "playsound", playMySound ) function stopMySound() stopSound( sound ) end addCommandHandler ( "stopsound", stopMySound ) is correct? what I have to do to. stop or start my sound in 3D? Link to comment
Walid Posted May 16, 2016 Share Posted May 16, 2016 function sounFunction(cmd) if cmd == "playsound" then if isElement(sound) then stopSound( sound ) end sound = playSound3D("sounds/song.mp3", 373.14, -125.21, 1001, false) elseif cmd == "stopsound" then if isElement(sound) then stopSound( sound ) end end end addCommandHandler ("playsound", sounFunction) addCommandHandler ("stopsound", sounFunction) 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