Jump to content

What function?


Carbonik

Recommended Posts

Hi i have problem, who can give me function to play sound when i use bind and when i use again (OFF function) then sound stop play.

Examle:

I press "x" , function starts operation and play sound.

I press again "x" for stop function operation and the sound stops playing

I thought that onStart or something

Link to comment
  
local sound = false 
function onClientPressX (key, keyState) 
        if sound then  
               destroyElement(sound) 
               sound = false 
        else 
               sound = playSound("song.mp3") 
        end 
end 
bindKey("X", "down", onClientPressX)  
  

Remember, this is a client side script and the sounds should be added into the meta.

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