Jump to content

How to end onVehicleExit


ViRuZGamiing

Recommended Posts

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

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