Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. --[[
  2.  
  3. ** Warning **: This code is not tested so it might give errors.
  4.     If that is the case please post what's wrong so it can be fixed fast.
  5.  
  6. ]]--
  7.  
  8. function playSoundOnStartMap (  )
  9.    
  10.     myNewMapSong = playSound ( "song.mp3" ) -- you're song name ( should be in the map folder )
  11.    
  12. end
  13.  
  14. addEventHandler ( "onClientResourceStart", root, playSoundOnStartMap )
  15.  
  16. -- bind keys to turn on / off music
  17.  
  18. function toggleSongOff (  )
  19.  
  20.     setSoundPaused ( myNewMapSong, true )
  21.     bindKey ( "m", "down", toggleSongOff ) -- pause the song
  22.    
  23. end
  24.  
  25. function toggleSongBackOn (  )
  26.  
  27.     if (isSoundPaused ( myNewMapSong ) == true ) then
  28.     local bindKeyToPlaySong = bindKey ( "m", "down", toggleSongBackOn )
  29.         if ( bindKeyToPlaySong ) then
  30.             setSoundPaused ( myNewMapSong, false )
  31.         end
  32.     end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement