screenX, screenY = guiGetScreenSize()
function kiiromanevem()
outputChatBox("#005588[info]:#ffffff Mute Radio #232323Press #0066EEi", 255, 255, 255, true)
end
addEventHandler("onClientResourceStart", resourceRoot, kiiromanevem)
function loadxml()
xmlFile = xmlLoadFile("options.xml")
if xmlFile then
animations = xmlFindChild(xmlFile, "animate", 0)
anim_mutat = xmlNodeGetValue(xmlFindChild(animations, "in", 0))
anim_rejt = xmlNodeGetValue(xmlFindChild(animations, "out", 0))
anim_speed = xmlNodeGetValue(xmlFindChild(animations, "speed", 0))
url = xmlNodeGetValue(xmlFindChild(xmlFile, "url", 0))
autoplay = xmlNodeGetValue(xmlFindChild(xmlFile, "autoplay", 0))
else
create_xmlFile = xmlCreateFile("options.xml", "root")
create_animations = xmlCreateChild(create_xmlFile, "animate")
xmlNodeSetValue(xmlCreateChild(create_animations, "in"), "OutBounce")
xmlNodeSetValue(xmlCreateChild(create_animations, "out"), "OutBounce")
xmlNodeSetValue(xmlCreateChild(create_animations, "speed"), "700")
xmlNodeSetValue(xmlCreateChild(create_xmlFile, "url"), "http://stream.dubbase.fm:7004")
xmlNodeSetValue(xmlCreateChild(create_xmlFile, "autoplay"), "true")
xmlSaveFile(create_xmlFile)
xmlFile = xmlLoadFile("options.xml")
animations = xmlFindChild(xmlFile, "animate", 0)
anim_mutat = xmlNodeGetValue(xmlFindChild(animations, "in", 0))
anim_rejt = xmlNodeGetValue(xmlFindChild(animations, "out", 0))
anim_speed = xmlNodeGetValue(xmlFindChild(animations, "speed", 0))
url = xmlNodeGetValue(xmlFindChild(xmlFile, "url", 0))
autoplay = xmlNodeGetValue(xmlFindChild(xmlFile, "autoplay", 0))
end
end
addEventHandler("onClientResourceStart", resourceRoot, loadxml)
addCommandHandler("reloadmxml", loadxml)
function zeneindit()
zene = playSound(url, true)
outputChatBox("#005588[Radio]:#ffffff On", 255, 255, 255, true)
setRadioChannel(0)
end
function bekapcs_kikapcs()
if allapot then
outputChatBox("#005588[Radio]:#ffffff Off", 255, 255, 255, true)
stopSound(zene)
allapot = false
xmlNodeSetValue(xmlFindChild(xmlFile, "autoplay", 0), "false")
xmlSaveFile(xmlFile)
else
zeneindit()
allapot = true
xmlNodeSetValue(xmlFindChild(xmlFile, "autoplay", 0), "true")
xmlSaveFile(xmlFile)
end
end
function ellenorizd_hogy_inulhat()
if autoplay == "true" then
bekapcs_kikapcs()
end
end
addEventHandler("onClientResourceStart", resourceRoot, ellenorizd_hogy_inulhat)
bindKey("i", "down", bekapcs_kikapcs)
function mimegy()
most = getSoundMetaTags(zene)
outputChatBox("#005588[Radio]:#ffffff Now Play: " .. most.stream_title, 255, 255, 255, true)
end
addCommandHandler("nowc", mimegy)
function makeRadioStayOff()
setRadioChannel(0)
cancelEvent()
end
addEventHandler("onClientPlayerRadioSwitch", getRootElement(), makeRadioStayOff)
function tobbimute()
if allapot then
for id = 1, #getElementsByType("sound") do
if getElementsByType("sound")[id] ~= zene then
soundLength = getSoundLength(getElementsByType("sound")[id])
if soundLength > 30 then
setSoundVolume(getElementsByType("sound")[id], 0)
end
end
end
elseif not nemitas then
for id = 1, #getElementsByType("sound") do
if getElementsByType("sound")[id] ~= zene then
soundLength = getSoundLength(getElementsByType("sound")[id])
if soundLength > 30 then
setSoundVolume(getElementsByType("sound")[id], 1)
end
end
end
end
end
addEventHandler("onClientRender", getRootElement(), tobbimute)
addEventHandler("onClientRender", getRootElement(), function()
most = getSoundMetaTags(zene)
mimegy = most.stream_title
if not mostmegy then
mostmegy = "zene"
end
if mostmegy ~= mimegy then
mostmegy = mimegy
mutat()
end
end)
-- screenX, screenY [890]
function asd()
textWidth = dxGetTextWidth(most.stream_title, 1, "default-bold")
textWidth = textWidth / 2
tick = getTickCount()
posY = interpolateBetween(screenX + 10, 0, 0, screenY - screenY/1.01123595505618, 0, 0, 1, "OutBounce")
dxDrawRectangle(screenX / 2 - textWidth - 6, posY - 2, textWidth * 2 + 12, 63, tocolor(0, 0, 0, 255))
dxDrawRectangle(screenX / 2 - textWidth - 5, posY - 1, textWidth * 2 + 10, 30, tocolor(23, 23, 23, 255))
dxDrawRectangle(screenX / 2 - textWidth - 5, posY + 30, textWidth * 2 + 10, 30, tocolor(10, 10, 10, 255))
dxDrawText("Now", screenX / 2 - textWidth, posY - 1, screenX / 2 + textWidth, posY + 30, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "center", false, false, true, false, false)
dxDrawText(most.stream_title, screenX / 2 - textWidth, posY + 30, screenX / 2 + textWidth, posY + 60, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "center", false, false, true, false, false)
if 5 <= (tick - tick2) / 1200 then
rejt()
end
end
function asd2()
textWidth = dxGetTextWidth(most.stream_title, 1, "default-bold")
textWidth = textWidth / 2
tick = getTickCount()
posY = interpolateBetween(screenX - screenY - screenY/1.01123595505618, 0, 0, screenY + 10, 0, 0, 1, "OutBounce")
dxDrawRectangle(screenX / 2 - textWidth - 6, posY - 2, textWidth * 2 + 12, 63, tocolor(0, 0, 0, 255))
dxDrawRectangle(screenX / 2 - textWidth - 5, posY - 1, textWidth * 2 + 10, 30, tocolor(23, 23, 23, 255))
dxDrawRectangle(screenX / 2 - textWidth - 5, posY + 30, textWidth * 2 + 10, 30, tocolor(10, 10, 10, 255))
dxDrawText("Now", screenX / 2 - textWidth, posY - 1, screenX / 2 + textWidth, posY + 30, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "center", false, false, true, false, false)
dxDrawText(most.stream_title, screenX / 2 - textWidth, posY + 30, screenX / 2 + textWidth, posY + 60, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "center", false, false, true, false, false)
end
function mutat()
tick2 = getTickCount()
removeEventHandler("onClientRender", getRootElement(), asd2)
addEventHandler("onClientRender", getRootElement(), asd)
end
addCommandHandler("now", mutat)
function rejt()
tick3 = getTickCount()
addEventHandler("onClientRender", getRootElement(), asd2)
removeEventHandler("onClientRender", getRootElement(), asd)
end
function zene_nemitas()
if allapot then
if nemitas then
for id = 1, #getElementsByType("sound") do
if getElementsByType("sound")[id] then
soundLength = getSoundLength(getElementsByType("sound")[id])
if getElementsByType("sound")[id] == zene then
setSoundVolume(getElementsByType("sound")[id], 0)
end
end
end
else
for id = 1, #getElementsByType("sound") do
if getElementsByType("sound")[id] == zene then
setSoundVolume(getElementsByType("sound")[id], 1)
end
end
end
elseif nemitas then
for id = 1, #getElementsByType("sound") do
if getElementsByType("sound")[id] then
soundLength = getSoundLength(getElementsByType("sound")[id])
if soundLength > 30 then
setSoundVolume(getElementsByType("sound")[id], 0)
end
end
end
else
for id = 1, #getElementsByType("sound") do
if getElementsByType("sound")[id] then
soundLength = getSoundLength(getElementsByType("sound")[id])
if soundLength > 30 then
setSoundVolume(getElementsByType("sound")[id], 1)
end
end
end
end
end
addEventHandler("onClientRender", getRootElement(), zene_nemitas)
function nemit_ellenoriz()
if nemitas then
contador = getTickCount()
addEventHandler("onClientRender", getRootElement(), encendidoFunc)
nemitas = false
else
contador = getTickCount()
addEventHandler("onClientRender", getRootElement(), apagadoFunc)
nemitas = true
end
end
bindKey("m", "down", nemit_ellenoriz)
function apagadoFunc()
if nemitas then
if 1 >= (getTickCount() - contador) / 1200 then
kep1, kep2 = interpolateBetween(0, 0, 0, 64, 64, 0, 1, "OutElastic")
elseif 1 <= (getTickCount() - contador) / 1200 then
kep1, kep2 = interpolateBetween(64, 64, 0, 0, 0, 0, 1, "InElastic")
if 1 == 1 then
removeEventHandler("onClientRender", getRootElement(), apagadoFunc)
end
end
dxDrawImage(screenX / 2 - kep1 / 2, screenY - 100 - kep2 / 2, kep1, kep2, "images/soundoff.png")
end
end
function encendidoFunc()
if not nemitas then
if 1 >= (getTickCount() - contador) / 1200 then
kep1, kep2 = interpolateBetween(0, 0, 0, 64, 64, 0, 1, "OutElastic")
elseif 1 <= (getTickCount() - contador) / 1200 then
kep1, kep2 = interpolateBetween(64, 64, 0, 0, 0, 0, 1, "InElastic")
if 1 == 1 then
removeEventHandler("onClientRender", getRootElement(), encendidoFunc)
end
end
dxDrawImage(screenX / 2 - kep1 / 2, screenY - 100 - kep2 / 2, kep1, kep2, "images/soundon.png")
end
end