[YARDIM] Radyo Font

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı By.z3y3

  • Yeni Üye
  • *
    • İleti: 69
: 31 Ağustos 2019, 00:07:13
Merhaba arkadaşlar mahlukatın forumda paylaşmış oldu radyo scriptini kulanıyorum fakat şöyle bişey yapmak istiyorum radyo font eklemek istiyorum fakat bir kaç denememde radyo scriptini bozdum bu konuda bana yardımcı olacak  biri var mı.

Client:
Kod
local radyolar = {}
local sx,sy = guiGetScreenSize()
local pg,pu = 100,20
local x,y = (sx-pg)/2,10

local radyoYazi,renderDurum,yaziY,yaziAlpha = "",false,0,255
local sound,radyo = nil,0 -- başlangıçta sound ve radyo yok yapıyoz

local xml = xmlLoadFile ( "settings.xml" )
local nodeColor,nodeFont,nodeStations = xmlFindChild ( xml, "color", 0 ), xmlFindChild ( xml, "font", 0 ),xmlFindChild ( xml, "stations", 0 )
local r,g,b = xmlNodeGetAttribute(nodeColor,"r"),xmlNodeGetAttribute(nodeColor,"g"),xmlNodeGetAttribute(nodeColor,"b")
local font = xmlNodeGetValue(nodeFont)

addEventHandler ( "onClientResourceStart", resourceRoot,function()
showPlayerHudComponent ( "radio", false )
for i, v in ipairs (xmlNodeGetChildren (nodeStations)) do
local node = xmlFindChild (nodeStations, "station",i)
if node then
local radioName = xmlNodeGetAttribute ( node, "name" )
local radioURL = xmlNodeGetAttribute ( node, "URL" )
table.insert(radyolar,{isim=radioName,url=radioURL})
end
end
end)

addEventHandler ( "onClientResourceStop", resourceRoot,function()
showPlayerHudComponent ( "radio", true )
end)

bindKey("radio_next", "down",function()
if not getPedOccupiedVehicle(localPlayer) then return end
radyo = radyo +1
if radyo > #radyolar-1 then
radyo = 0
end
radyoDegis(radyo)
end)
bindKey("radio_previous", "down",function()
if not getPedOccupiedVehicle(localPlayer) then return end
radyo = radyo-1
if radyo < 0 then
radyo = #radyolar-1
end
radyoDegis(radyo)
end)

function radyoDegis(radyo)
setRadioChannel(0) if isElement(sound) then destroyElement(sound) end
if radyo > 0 then -- eğer radyo varsa
local isim,url = radyolar[radyo].isim,radyolar[radyo].url
sound = playSound(url)
radyoYaziOlustur(isim)
else
radyoYaziOlustur("Radyo Kapalı")
end
end

function radyoYaziOlustur(yazi)
radyoYazi = yazi
showPlayerHudComponent ( "radio", false )
if isTimer(renderTimer) then killTimer(renderTimer) end

yaziY,yaziAlpha = 0,255
if not renderDurum then
removeEventHandler ( "onClientPreRender", root, render )
addEventHandler ( "onClientPreRender", root, render )
end
renderTimer=setTimer(function()
renderDurum = false
end,5000,1)
renderDurum = true
kaybolmaTick = getTickCount()+200
end

function render()
if renderDurum then
dxDrawText(radyoYazi,2,yaziY+2,sx,(sy/1.2)+yaziY, tocolor( 0, 0, 0, yaziAlpha ), 1.6, font, "center", "bottom" )
dxDrawText(radyoYazi, 0, yaziY+2, sx,(sy/1.2)+yaziY, tocolor( r, g, b, yaziAlpha ), 1.6, font, "center", "bottom" )
yaziY =  yaziY + sy * 0.0025
if ( getTickCount ( ) >= kaybolmaTick ) then
yaziAlpha = yaziAlpha - 3
if ( yaziAlpha < 0 ) then
renderDurum = false
end
end
else
removeEventHandler ( "onClientPreRender", root, render )
end
end

addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer (),function ( vehicle, seat )
radyoDegis(radyo)
timerVehicle = setTimer(function(vehicle)
if isPedInVehicle ( getLocalPlayer () ) == false or getPedOccupiedVehicle ( getLocalPlayer () ) ~= vehicle or getElementHealth ( getLocalPlayer () ) <= 0 then
if isElement (sound ) then destroyElement (sound) end
killTimer (timerVehicle)
end
end,50,0,vehicle )
end)

addEventHandler ( "onClientVehicleStartExit", getRootElement (),function ( player )
if player == getLocalPlayer () then
if isElement(sound) then destroyElement(sound) end if isTimer (timerVehicle) then killTimer (timerVehicle) end
end
end)

addEventHandler ( "onClientVehicleExit", getRootElement (),function ( player )
if player == getLocalPlayer () then
if isElement(sound) then destroyElement(sound) end if isTimer (timerVehicle) then killTimer (timerVehicle) end
end
end)

addEventHandler("onClientElementDestroy",getRootElement(), function ()
if getElementType(source) == "vehicle" and getPedOccupiedVehicle(getLocalPlayer()) == source then
if isElement(sound) then destroyElement(sound) end if isTimer (timerVehicle) then killTimer (timerVehicle) end
end
end)


Settings:
Kod
<settings>
<color r="0" g="102" b="0"/><!-- Radio label color -->
<font>default-bold</font><!-- Radio label font -->
<stations><!-- Radio stations. To add one: <station name="[name here]" URL="[URL here]"/> -->
    <station name="Alem FM" URL="http://scturkmedya.radyotvonline.com/stream/80/"/>
<station name="Ankara Havası" URL="http://37.247.98.8/stream/30/"/>
<station name="Damar FM" URL="http://yayin.damarfm.com:8080/listen.pls"/>
<station name="Park FM" URL="http://yayin.netradyom.com:8050/PARKFM"/>
<station name="Banko" URL="http://yayin.netradyom.com:8050/RADYOBANKO"/>
<station name="Megasite" URL="http://mega.netradyom.com:7900/listen.pls"/>
<station name="Best FM" URL="http://46.20.7.125/listen.pls"/>
<station name="Kral FM" URL="http://kralsc.radyotvonline.com/listen.pls"/>
<station name="Kral Pop" URL="http://kralpopwmp.radyotvonline.com:80/;"/>
<station name="Haber FM" URL="http://yayin.yayindakiler.com:4118/;"/>
<station name="Efkarlı FM" URL="http://159.253.37.137:9814/;"/>
<station name="Super FM" URL="http://provisioning.streamtheworld.com/pls/SUPER_FMAAC.pls"/>
<station name="Slow Türk" URL="http://radyo.dogannet.tv/slowturk"/>
<station name="Radyo Dejavu" URL="http://radyodejavu.canliyayinda.com:8054/"/>
<station name="Joy Fm" URL="http://provisioning.streamtheworld.com/pls/JOY_FMAAC.pls"/>
<station name="Joy Jazz" URL="http://provisioning.streamtheworld.com/pls/JOY_JAZZAAC.pls"/>
<station name="Joy Türk" URL="http://provisioning.streamtheworld.com/pls/JOY_TURKAAC.pls"/>
<station name="Joy Türk Akustik" URL="http://provisioning.streamtheworld.com/pls/JOYTURK_AKUSTIKAAC.pls"/>
<station name="Joy Türk Rock" URL="http://provisioning.streamtheworld.com/pls/JOYTURK_ROCKAAC.pls"/>
<station name="Metro FM" URL="http://provisioning.streamtheworld.com/pls/METRO_FMAAC.pls"/>
<station name="Karadeniz FM" URL="http://46.20.7.100/stream/170/"/>
<station name="My Donese" URL="http://provisioning.streamtheworld.com/pls/RADIO_MYDONOSEAAC.pls"/>
<station name="DJ FM" URL="http://37.1.144.106:9001/;stream/1"/>
<station name="Türkçe Rap" URL="http://95.173.188.166:9984/listen.pls"/>
<station name="Number One Türk" URL="http://nmbshsource.mediatriple.net:7000/stream/28/"/>
<station name="Fenomen FM" URL="http://fenomenclubbin.listenfenomen.com/fenomenclubbin/128/icecast.audio"/>
<station name="Dance FM" URL="http://uk2.internet-radio.com:8024/listen.pls&t=.m3u"/>
<station name="Radyo Kapalı" URL=""/>
</stations>
</settings>
« Son Düzenleme: 13 Eylül 2019, 03:29:06 Gönderen: Narkoz »
 


MTASATURK

[YARDIM] Radyo Font
« : 31 Ağustos 2019, 00:07:13 »

Çevrimdışı Ky

  • Uzman Üye
  • *
    • İleti: 614
Yanıtla #1 : 31 Ağustos 2019, 18:38:08
Settings bölümünde zaten belirtmiş MTA orjinal font kullanmak istiyorsan aşağıdaki siteye bak kendi fontunu kullanmak istiyorsan yaz tekrar buraya anlatayım.
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı By.z3y3

  • Yeni Üye
  • *
    • İleti: 69
Yanıtla #2 : 31 Ağustos 2019, 19:39:41
Kendi fontumu koymak istiyorum
 


Çevrimdışı Ky

  • Uzman Üye
  • *
    • İleti: 614
Yanıtla #3 : 31 Ağustos 2019, 21:46:18
Al ekledim 12.satırda dxCreateFont kısmı var oranın tırnak içinde olan kısmı senin fontundur ben fontum12.ttf yazdım oranın yanındaki 20 değeri ise fontun büyüklüğüdür kendine bir font bul istediğin sonra o fontun adını fontum12 yap ve fontun .ttf dosyası olduğundan emin ol ardından meta.xml içerisine aşağıya attığım kodu ekle.
Client.lua
Kod
local radyolar = {}
local sx,sy = guiGetScreenSize()
local pg,pu = 100,20
local x,y = (sx-pg)/2,10

local radyoYazi,renderDurum,yaziY,yaziAlpha = "",false,0,255
local sound,radyo = nil,0 -- başlangıçta sound ve radyo yok yapıyoz

local xml = xmlLoadFile ( "settings.xml" )
local nodeColor,nodeFont,nodeStations = xmlFindChild ( xml, "color", 0 ), xmlFindChild ( xml, "font", 0 ),xmlFindChild ( xml, "stations", 0 )
local r,g,b = xmlNodeGetAttribute(nodeColor,"r"),xmlNodeGetAttribute(nodeColor,"g"),xmlNodeGetAttribute(nodeColor,"b")
local font = dxCreateFont( "fontum12.ttf", 20 )

addEventHandler ( "onClientResourceStart", resourceRoot,function()
showPlayerHudComponent ( "radio", false )
for i, v in ipairs (xmlNodeGetChildren (nodeStations)) do
local node = xmlFindChild (nodeStations, "station",i)
if node then
local radioName = xmlNodeGetAttribute ( node, "name" )
local radioURL = xmlNodeGetAttribute ( node, "URL" )
table.insert(radyolar,{isim=radioName,url=radioURL})
end
end
end)

addEventHandler ( "onClientResourceStop", resourceRoot,function()
showPlayerHudComponent ( "radio", true )
end)

bindKey("radio_next", "down",function()
if not getPedOccupiedVehicle(localPlayer) then return end
radyo = radyo +1
if radyo > #radyolar-1 then
radyo = 0
end
radyoDegis(radyo)
end)
bindKey("radio_previous", "down",function()
if not getPedOccupiedVehicle(localPlayer) then return end
radyo = radyo-1
if radyo < 0 then
radyo = #radyolar-1
end
radyoDegis(radyo)
end)

function radyoDegis(radyo)
setRadioChannel(0) if isElement(sound) then destroyElement(sound) end
if radyo > 0 then -- eğer radyo varsa
local isim,url = radyolar[radyo].isim,radyolar[radyo].url
sound = playSound(url)
radyoYaziOlustur(isim)
else
radyoYaziOlustur("Radyo Kapalı")
end
end

function radyoYaziOlustur(yazi)
radyoYazi = yazi
showPlayerHudComponent ( "radio", false )
if isTimer(renderTimer) then killTimer(renderTimer) end

yaziY,yaziAlpha = 0,255
if not renderDurum then
removeEventHandler ( "onClientPreRender", root, render )
addEventHandler ( "onClientPreRender", root, render )
end
renderTimer=setTimer(function()
renderDurum = false
end,5000,1)
renderDurum = true
kaybolmaTick = getTickCount()+200
end

function render()
if renderDurum then
dxDrawText(radyoYazi,2,yaziY+2,sx,(sy/1.2)+yaziY, tocolor( 0, 0, 0, yaziAlpha ), 1.6, font, "center", "bottom" )
dxDrawText(radyoYazi, 0, yaziY+2, sx,(sy/1.2)+yaziY, tocolor( r, g, b, yaziAlpha ), 1.6, font, "center", "bottom" )
yaziY =  yaziY + sy * 0.0025
if ( getTickCount ( ) >= kaybolmaTick ) then
yaziAlpha = yaziAlpha - 3
if ( yaziAlpha < 0 ) then
renderDurum = false
end
end
else
removeEventHandler ( "onClientPreRender", root, render )
end
end

addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer (),function ( vehicle, seat )
radyoDegis(radyo)
timerVehicle = setTimer(function(vehicle)
if isPedInVehicle ( getLocalPlayer () ) == false or getPedOccupiedVehicle ( getLocalPlayer () ) ~= vehicle or getElementHealth ( getLocalPlayer () ) <= 0 then
if isElement (sound ) then destroyElement (sound) end
killTimer (timerVehicle)
end
end,50,0,vehicle )
end)

addEventHandler ( "onClientVehicleStartExit", getRootElement (),function ( player )
if player == getLocalPlayer () then
if isElement(sound) then destroyElement(sound) end if isTimer (timerVehicle) then killTimer (timerVehicle) end
end
end)

addEventHandler ( "onClientVehicleExit", getRootElement (),function ( player )
if player == getLocalPlayer () then
if isElement(sound) then destroyElement(sound) end if isTimer (timerVehicle) then killTimer (timerVehicle) end
end
end)

addEventHandler("onClientElementDestroy",getRootElement(), function ()
if getElementType(source) == "vehicle" and getPedOccupiedVehicle(getLocalPlayer()) == source then
if isElement(sound) then destroyElement(sound) end if isTimer (timerVehicle) then killTimer (timerVehicle) end
end
end)

Meta.xml içerisine ekliyeceğin kod
Kod
<file src="fontum12.ttf" />
 


Çevrimdışı By.z3y3

  • Yeni Üye
  • *
    • İleti: 69
Yanıtla #4 : 31 Ağustos 2019, 21:50:07
Teşekkür ederim istedim şekilde oldu.
 
Mesajı Beğenenler: Ky