Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.17 KB | None | 0 0
  1. local radios = {
  2.     {name="Radio Off", value = 0},
  3.     {name="Playback FM", value = 1},
  4.     {name="K-Rose", value = 2},
  5.     {name="K-DST", value = 3},
  6.     {name="Bounce FM", value = 4},
  7.     {name="SF-UR", value = 5},
  8.     {name="Radio Lost Santos", value = 6},
  9.     {name="Radio X", value = 7},
  10.     {name="CSR 103.9", value = 8},
  11.     {name="K-Jah West", value = 9},
  12.     {name="Master Sounds 98.3", value = 10},
  13.     {name="WCTR", value = 11},
  14.     {name="User Track Player", value = 12},
  15.     {url = "http://trace.dnbradio.com/dnbradio.mp3",name = "DnB Radio"},
  16.     {url = "http://listen.181fm.com:8070",name = "181FM"},
  17.     {url = "http://edmzone.eu/play.pls",name = "EDM:Zone"},
  18.     {url = "http://y0b.net/rnr.m3u",name = "RnR"},
  19.     {url = "http://y0b.net/radiosa.m3u",name = "Radio:SA"},
  20.     {url = "http://y0b.net/msx.m3u",name = "MsX"},
  21.     {url = "http://198.100.145.185:8900/stream",name = "Untitled"},
  22.     {url = "http://death.fm/modules/Listen/MP3-hi.asx",name = "Death Fm"}
  23. }
  24. local counter = 0
  25. local currentSound = false
  26.  
  27. setRadioChannel(0)
  28.  
  29. addEventHandler( "onClientKey", root, function(button,press)
  30.         if button == "mouse_wheel_up" or button == "mouse_wheel_down" then
  31.             if isPedInVehicle(localPlayer) then
  32.                 changeRadioStation(button)
  33.             end
  34.         end
  35.     end)
  36.  
  37. function changeRadioStation(action)
  38.     if action == "mouse_wheel_up" then
  39.         counter = counter + 1
  40.         if counter > #radios then
  41.             counter = 0
  42.         end
  43.     else
  44.         counter = counter - 1  
  45.         if counter < 0 then
  46.             counter = #radios
  47.         end
  48.     end
  49.  
  50.     setRadioStation()
  51. end
  52.  
  53. function setRadioStation()
  54.     if isElement(currentSound) then stopSound(currentSound) end
  55.     if counter <= 12 then
  56.         outputChatBox(counter)
  57.         setRadioChannel(radios[counter].value)
  58.     end
  59.     if counter >= 13 then
  60.         currentSound = playSound(radios[counter].url, true)
  61.     end
  62. end
  63.  
  64. addEventHandler("onClientPlayerRadioSwitch", localPlayer, function()
  65.     if counter >= 13 then cancelEvent() end
  66. end)
  67.  
  68. addEventHandler("onClientPlayerVehicleEnter", localPlayer, function()
  69.     setRadioStation()
  70. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement