local customRadio = true
local player = getLocalPlayer()
local textRadio = ""
local currentRadio = ""
local currentIndex = 1
local localPlayer = getLocalPlayer()
local sx,sy = guiGetScreenSize ()
local loltimer = nil
local templol = false
local _setRadioChannel = setRadioChannel
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()
setRadioChannel (0)
bindKey ("radio_next","down",
function(key,state)
setRadioChannel(0);
if playRadioThing then
destroyElement(playRadioThing);
end
playRadioThing = nil;
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
destroyElement(playRadioThing)
end
else
playRadioThing = playSound (radio)
end
end
)
bindKey ("radio_previous","down",
function(key,state)
setRadioChannel(0);
if playRadioThing then
destroyElement(playRadioThing);
end
playRadioThing = nil
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
destroyElement(playRadioThing)
end
else
playRadioThing = playSound (radio)
end
end
)
end)
local x, y, z = getElementPosition ( localPlayer )
local radioHud = {
isRendering = false,
y = nil,
alpha = nil,
text = nil
}
function createBottomMovingText ( text )
showPlayerHudComponent ( "radio", not customRadio )
radioHud.text = text
if ( isTimer ( radioRemoveTimer ) ) then
killTimer ( radioRemoveTimer )
end
radioHud.y = 0
if not radioHud.isRendering then
addEventHandler ( "onClientPreRender", root, radioRender )
end
radioRemoveTimer = setTimer ( function ( )
radioHud.isRendering = false
end, 5000, 1 )
radioHud.isRendering = true
radioHud.alpha = 255
startRemoveTick = getTickCount ( ) + 200
end
addEventHandler ( "onClientPlayerRadioSwitch", localPlayer, function ( id )
if ( customRadio ) then
createBottomMovingText ( getRadioChannelName ( id ) )
end
end )
addEventHandler ( "onClientPlayerVehicleEnter", root, function ( veh )
if ( source == localPlayer and customVehicleNames ) then
createBottomMovingText ( getVehicleNameFromModel ( getElementModel ( veh ) ) )
end
end )
addEventHandler ("onClientVehicleStartExit",getRootElement(),
function(player)
if localPlayer == player then
if playRadioThing then
destroyElement (playRadioThing)
end
playRadioThing = nil
setRadioChannel (0)
textRadio = ""
end
end)
addEventHandler ("onClientVehicleExit",getRootElement(),
function(player)
if localPlayer == player then
if playRadioThing then
destroyElement(playRadioThing)
end
playRadioThing = nil
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
destroyElement(playRadioThing)
end
playRadioThing = nil
playRadioThing = playSound (radio)
end
end
end)
function setRadioChannel (index)
templol = true
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
destroyElement (playRadioThing)
end
playRadioThing = nil
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
destroyElement (playRadioThing)
end
playRadioThing = nil
setRadioChannel (0)
textRadio = ""
end
end
end)
local sx, sy = guiGetScreenSize ( )
function radioRender ( )
if radioHud.isRendering then
showPlayerHudComponent ( "radio", false )
dxDrawText ( textRadio, 2, radioHud.y+2, sx, ( sy/ 11 )+radioHud.y, tocolor ( 0, 0, 0, radioHud.alpha ), 1.5, "default-bold", "center", "bottom" )
dxDrawText ( textRadio, 0, 0, sx, ( sy/ 11 )+radioHud.y, tocolor ( 220, 140, 0, radioHud.alpha ), 1.5, "default-bold", "center", "bottom" )
--radioHud.y = radioHud.y + sy * 0.0025 --animasyonlu yazı gelmesi için aktif edebilirsin
if ( getTickCount ( ) >= startRemoveTick ) then
radioHud.alpha = radioHud.alpha - 3
if ( radioHud.alpha < 0 ) then
radioHud.isRendering = false
end
end
else
removeEventHandler ( "onClientPreRender", root, radioRender )
end
end
function tobool ( input )
local input = tostring ( input ):lower ( )
if ( input == "true" ) then
return true
elseif ( input == "false" ) then
return false
else
return nil
end
end