[YARDIM] Radyo Sorunu

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı DogukanUCAN

  • Acemi Üye
  • *
    • İleti: 177
  • Lowide Freeroam
: 31 Ocak 2018, 20:34:08
Alttaki vereceğim radyo scriptinde şöyle bir sorun var;
Normalde "R" tuşu ile değiştirirsek sorunsuz bir şekilde çalışıyor ama mausun tekerleği ile radyoyu değiştirirsek oyunun orjinal radyosu çalışmaya başlıyor ve sesler karışıyor bu soruna çözümü olan varsa düzenleyip atabilir mi? Şimdiden Teşekkürler.

Kod: lua
local textRadio = ""
local currentRadio = ""
local currentIndex = 1
local localPlayer = getLocalPlayer()
local sx,sy = guiGetScreenSize ()
local loltimer = nil
local templol = false

local radios = {"Radyo Kapalı",
  "Damar FM",
  "Park FM",
  "Megasite",
  "Banko",
  "Best FM",
  "Kral FM",
  "Super FM",
  "Slow Türk",
  "Power Türk",
  "Radyo Dejavu",
  "Joy Fm",
  "Joy Jazz",
  "Joy Türk",
  "Joy Türk Akustik",
  "Joy Türk Rock",
  "Karadeniz FM",
  "Metro FM",
  "Electro FM",
  "My Donese",
  "DJ FM",
  "Türkçe Rap",
}

local radioPaths = {0,
  "http://yayin.damarfm.com:8080/listen.pls",
  "http://park.netradyom.com:1345",
  "http://mega.netradyom.com:7900/listen.pls",
  "http://park.netradyom.com:11148/",
  "http://46.20.7.125/listen.pls",
  "http://kralsc.radyotvonline.com/listen.pls",
  "http://provisioning.streamtheworld.com/pls/SUPER_FMAAC.pls",
  "http://radyo.dogannet.tv/slowturk",
  "http://icast.powergroup.com.tr/PowerTurk/mpeg/128/home",
  "http://radyodejavu.canliyayinda.com:8054/",
  "http://provisioning.streamtheworld.com/pls/JOY_FMAAC.pls",
  "http://provisioning.streamtheworld.com/pls/JOY_JAZZAAC.pls",
  "http://provisioning.streamtheworld.com/pls/JOY_TURKAAC.pls",
  "http://provisioning.streamtheworld.com/pls/JOYTURK_AKUSTIKAAC.pls",
  "http://provisioning.streamtheworld.com/pls/JOYTURK_ROCKAAC.pls",
  "http://yayin1.canliyayin.org:8200/",
  "http://provisioning.streamtheworld.com/pls/METRO_FMAAC.pls",
  "http://stream.electroradio.ch:26630",
  "http://provisioning.streamtheworld.com/pls/RADIO_MYDONOSEAAC.pls",
  "http://37.1.144.106:9001/;stream/1",
  "http://95.173.188.166:9984/listen.pls"
}

local playRadioThing = nil

function resetTimer ()
  textRadio = ""
end

addEventHandler("onClientResourceStart",getResourceRootElement(),
function()
  outputChatBox ("")
  showPlayerHudComponent ("radio",false)
  setRadioChannel (0)
 
  bindKey ("radio_next","down",
    function(key,state)
      local nextIndex = ((currentIndex)%(#radioPaths)) +1
      currentIndex = nextIndex
      local radio = radioPaths[nextIndex]
      textRadio = radios[nextIndex]
      if loltimer and isTimer (loltimer) then
        killTimer (loltimer)
      end
      loltimer = setTimer (resetTimer,1000,1)
      if type (radio) == "number" then
        setRadioChannel (radio)
        if playRadioThing then
          stopSound (playRadioThing)
        end
      else
        setRadioChannel (0)
        if playRadioThing then
          stopSound (playRadioThing)
        end
        playRadioThing = playSound (radio)
      end
    end
  )
 
  bindKey ("radio_previous","down",
    function(key,state)
      local nextIndex = ((currentIndex -2)%(#radioPaths)) +1
      currentIndex = nextIndex
      local radio = radioPaths[nextIndex]
      textRadio = radios[nextIndex]
      if loltimer and isTimer (loltimer) then
        killTimer (loltimer)
      end
      loltimer = setTimer (resetTimer,1000,1)
      if type (radio) == "number" then
        setRadioChannel (radio)
        if playRadioThing then
          stopSound (playRadioThing)
        end
      else
        setRadioChannel (0)
        if playRadioThing then
          stopSound (playRadioThing)
        end
        playRadioThing = playSound (radio)
      end
    end
  )
 
end)

function renderRadio ()
  dxDrawText (textRadio,0,0,sx,96,-922761116,2,"sans","center","center",false,false,true)
end
addEventHandler ("onClientRender",getRootElement(),renderRadio)

addEventHandler ("onClientVehicleStartExit",getRootElement(),
function(player)
  if localPlayer == player then
    if playRadioThing then
      stopSound (playRadioThing)
    end
    setRadioChannel (0)
    textRadio = ""
  end
end)

addEventHandler ("onClientVehicleExit",getRootElement(),
function(player)
  if localPlayer == player then
    if playRadioThing then
      stopSound (playRadioThing)
    end
    setRadioChannel (0)
    textRadio = ""
  end
end)

addEventHandler ("onClientVehicleEnter",getRootElement(),
function(player)
  if localPlayer == player then
    local radio = radioPaths[currentIndex]
    textRadio = radios[currentIndex]
    if loltimer and isTimer (loltimer) then
      killTimer (loltimer)
    end
    loltimer = setTimer (resetTimer,1000,1)
    if type (radio) == "number" then
      setRadioChannel (radio)
      if playRadioThing then
        stopSound (playRadioThing)
      end
    else
      setRadioChannel (0)
      if playRadioThing then
        stopSound (playRadioThing)
      end
      playRadioThing = playSound (radio)
    end
  end
end)

_setRadioChannel = setRadioChannel

function setRadioChannel (index)
  templol = true
  _setRadioChannel (index)
end

addEventHandler ("onClientPlayerRadioSwitch",getRootElement(),
function()
  if templol == true then
    if not isPedInVehicle (localPlayer) then
      setRadioChannel (0)
    end
    templol = false
  else
    cancelEvent (true)
    if not isPedInVehicle (localPlayer) then
      setRadioChannel (0)
    end
  end
end)

addEventHandler("onClientElementDestroy",getRootElement(),
function()
  if source and getElementType (source) == "vehicle" then
    if source == getPedOccupiedVehicle (localPlayer) then
      if playRadioThing then
        stopSound (playRadioThing)
      end
      setRadioChannel (0)
      textRadio = ""
    end
  end
end)

addEventHandler("onClientVehicleExplode",getRootElement(),
function()
  if source and getElementType (source) == "vehicle" then
    if source == getPedOccupiedVehicle (localPlayer) then
      if playRadioThing then
        stopSound (playRadioThing)
      end
      setRadioChannel (0)
      textRadio = ""
    end
  end
end)

« Son Düzenleme: 04 Şubat 2018, 13:40:25 Gönderen: Narkoz »
 


MTASATURK

[YARDIM] Radyo Sorunu
« : 31 Ocak 2018, 20:34:08 »

Çevrimdışı Mahlukat

  • Uzman Üye
  • *
    • İleti: 637
Yanıtla #1 : 31 Ocak 2018, 21:08:55
Kod: lua
local sx, sy = guiGetScreenSize()
local wybrane = 1
local muzyka = false
local visible = false

local radia = {
{"Radyo Kapalı", false},
{"Damar FM", "http://yayin.damarfm.com:8080/listen.pls"},
{"Megasite",  "http://mega.netradyom.com:7900/listen.pls"},
{"Banko", "http://park.netradyom.com:11148/"},
{"Best FM", "http://46.20.7.125/listen.pls"},
{"Kral FM", "http://kralsc.radyotvonline.com/listen.pls"},
{"Super FM", "http://provisioning.streamtheworld.com/pls/SUPER_FMAAC.pls"},
{"Slow Türk", "http://radyo.dogannet.tv/slowturk"},
{"Power Türk", "http://icast.powergroup.com.tr/PowerTurk/mpeg/128/home"},
{"Radyo Dejavu", "http://radyodejavu.canliyayinda.com:8054/"},
{"Joy Fm", "http://provisioning.streamtheworld.com/pls/JOY_FMAAC.pls"},
{"Joy Jazz", "http://provisioning.streamtheworld.com/pls/JOY_JAZZAAC.pls"},
{"Joy Türk", "http://provisioning.streamtheworld.com/pls/JOY_TURKAAC.pls"},
{"Joy Türk Akustik", "http://provisioning.streamtheworld.com/pls/JOYTURK_AKUSTIKAAC.pls"},
{"Joy Türk Rock", "http://provisioning.streamtheworld.com/pls/JOYTURK_ROCKAAC.pls"},
{"Karadeniz FM", "http://yayin1.canliyayin.org:8200/"},
{"Metro FM", "http://provisioning.streamtheworld.com/pls/METRO_FMAAC.pls"},
{"Electro FM", "http://stream.electroradio.ch:26630"},
{"My Donese", "http://provisioning.streamtheworld.com/pls/RADIO_MYDONOSEAAC.pls"},
{"DJ FM", "http://37.1.144.106:9001/;stream/1"},
{"Türkçe Rap", "http://95.173.188.166:9984/listen.pls"},
}


addEventHandler("onClientRender", root, function()
if not getPedOccupiedVehicle(localPlayer) and muzyka and isElement(muzyka) then
visible = false
stopSound(muzyka)
muzyka = false
wybrane = 1
end
if visible == true then
dxDrawText (radia[wybrane][1],0,0,sx,96,-922761116,2,"sans","center","center",false,false,true)
end
end)

bindKey("mouse_wheel_down", "both", function()
if not isPedInVehicle(localPlayer) then return end
if wybrane == 1 or getKeyState("lshift") == true then return end
wybrane = wybrane-1
if muzyka and isElement(muzyka) then
stopSound(muzyka)
muzyka = false
end
if radia[wybrane][2] ~= false then
muzyka = playSound(radia[wybrane][2])
end
visible = true
setTimer(function()
visible = false
end, 3000, 1)
end)

bindKey("mouse_wheel_up", "both", function()
if not isPedInVehicle(localPlayer) then return end
if wybrane == #radia or getKeyState("lshift") == true then return end
wybrane = wybrane+1
if muzyka and isElement(muzyka) then
stopSound(muzyka)
muzyka = false
end
if radia[wybrane][2] ~= false then
muzyka = playSound(radia[wybrane][2])
end
visible = true
setTimer(function()
visible = false
end, 3000, 1)
end)
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı DogukanUCAN

  • Acemi Üye
  • *
    • İleti: 177
  • Lowide Freeroam
Yanıtla #2 : 31 Ocak 2018, 21:12:33
Kendini script konusunda baya ilerlettiğini düşünüyorum kardeşim. Scripter alımı olursa mutlaka başvur.

Konu Kilit.
 


Çevrimdışı Mahlukat

  • Uzman Üye
  • *
    • İleti: 637
Yanıtla #3 : 31 Ocak 2018, 21:13:49
Linki görebilmek için Kayıt olun yada Giriş yapın.
Kendini script konusunda baya ilerlettiğini düşünüyorum kardeşim. Scripter alımı olursa mutlaka başvur.

Konu Kilit.
Teşekkürler ama alıntı kod xd
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı ByCash

  • Admin
  • *
    • İleti: 986
Yanıtla #4 : 31 Ocak 2018, 21:23:30
Konu sahibinin isteği üzerine konu kilitlenmiştir.