ExtremeSB Posted April 24, 2013 Posted April 24, 2013 Tenho este script de radio: local musicStream = "http://7719.live.streamtheworld.com:3690/MEGA_HITS_SC" function onResourceStart() sound = playSound( musicStream, true) end function makeRadioStayOff() setRadioChannel(0) cancelEvent() end function toggleSong() if not songOff then setSoundVolume(sound,0) songOff = true removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) else setSoundVolume(sound,1) songOff = false setRadioChannel(0) addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onResourceStart) addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff) addCommandHandler("radio",toggleSong) bindKey("m","down","radio") Como coloco ele a começar desligado, pk quando entro fica logo com o radio ligado, eu queria que fique desligado e so ligue quando clicar no bind
manawydan Posted April 24, 2013 Posted April 24, 2013 talvez eu possa te ajudar um pouco. o evento addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onResourceStart) faz com que quando o recurso carrega a musica fica ligada. você usou bindKey("m","down","radio") nao vi a função radio. "Querer não é poder, mas tentar é avançar"!
DNL291 Posted April 25, 2013 Posted April 25, 2013 Como manawydan disse, o evento "onClientResourceStart" está ligado a função que irá tocar o som. Ou seja, o som irá tocar quando o recurso for iniciado. Please do not PM me with scripting related question nor support, use the forums instead.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now