ViRuZGamiing Posted December 29, 2013 Share Posted December 29, 2013 As title says, local dubstepSound = { "sounds/1.mp3", "sounds/2.mp3", } local sound = nil local keyBoundedDubStep = false local lastTrack = nil local controlDubstepClient = function (playState) if not isElement(sound) then local dubstepSound = dubstepSound if lastTrack then table.remove(dubstepSound,lastTrack) end sound = playSound(dubstepSound[ math.random( #dubstepSound )]) elseif playState then setSoundPaused (sound,not isSoundPaused ( sound )) end end local dubstepClient = function () if not keyBoundedDubStep then bindKey ( "M", "down", controlDubstepClient,true) keyBoundedDubStep = true end if isElement(sound) then stopSound(sound) end sound = playSound(dubstepSound[ math.random( #dubstepSound )]) end addEvent("dubstepPlay", true) addEventHandler("dubstepPlay", root, dubstepClient) addEventHandler ( "onClientSoundStopped", root, function (reason) if reason == "finished" then local dubstepSound = dubstepSound if lastTrack then table.remove(dubstepSound,lastTrack) end sound = playSound(dubstepSound[ math.random( #dubstepSound )]) end end) Link to comment
Castillo Posted December 29, 2013 Share Posted December 29, 2013 What do you mean by "end"? Link to comment
ViRuZGamiing Posted December 29, 2013 Author Share Posted December 29, 2013 It's fixed, by end I ment end the mp3. did it with onClientVehicleExit. 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