Niick Posted December 18, 2019 Posted December 18, 2019 Boa Noite rapaziada, to com esse script de musica no painel de login, porem quando eu logo a musica continua tocando, alguem poderia ajuda? -- by dzek, dzek.metal.info/mta/ addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() -- little interval, music is getting laggy when all resources are starting.. setTimer(function() playSound("joinsound.mp3") end, 2000, 1) end )
SetMarcos Posted December 18, 2019 Posted December 18, 2019 client.Lua function playmusic() sound = playSound("joinsound.mp3") end function stopmusic() stopSound(sound) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() -- little interval, music is getting laggy when all resources are starting.. setTimer(function() playmusic() end, 2000, 1) end ) function pararsom() stopmusic() end addEvent("pararsom", true) addEventHandler("pararsom", root, pararsom) server.Lua -- root = getElementRoot() addEventHandler("onPlayerLogin", root, function() triggerClientEvent ( source,"pararsom",source) end ) http://www.infeczumbi.ga/
Niick Posted December 18, 2019 Author Posted December 18, 2019 1 hour ago, SetMarcos said: client.Lua function playmusic() sound = playSound("joinsound.mp3") end function stopmusic() stopSound(sound) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() -- little interval, music is getting laggy when all resources are starting.. setTimer(function() playmusic() end, 2000, 1) end ) function pararsom() stopmusic() end addEvent("pararsom", true) addEventHandler("pararsom", root, pararsom) server.Lua -- root = getElementRoot() addEventHandler("onPlayerLogin", root, function() triggerClientEvent ( source,"pararsom",source) end ) Testei aqui, e nao funcionou
Moderators Lord Henry Posted December 18, 2019 Moderators Posted December 18, 2019 Client function stopmusic() if (isElement (sound)) then stopSound(sound) end end addEvent ("pararsom", true) addEventHandler ("pararsom", root, stopmusic) addEventHandler ("onClientResourceStart", resourceRoot, function() setTimer (function() sound = playSound ("joinsound.mp3") end, 2000, 1) end) Server addEventHandler ("onPlayerLogin", root, function() triggerClientEvent (source, "pararsom", source) end) 1 Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
Niick Posted December 18, 2019 Author Posted December 18, 2019 1 hour ago, Lord Henry said: Client function stopmusic() if (isElement (sound)) then stopSound(sound) end end addEvent ("pararsom", true) addEventHandler ("pararsom", root, stopmusic) addEventHandler ("onClientResourceStart", resourceRoot, function() setTimer (function() sound = playSound ("joinsound.mp3") end, 2000, 1) end) Server addEventHandler ("onPlayerLogin", root, function() triggerClientEvent (source, "pararsom", source) end) Testei aqui, não funcionou tambem
Tommy. Posted December 18, 2019 Posted December 18, 2019 1 hour ago, Niick said: Testei aqui, não funcionou tambem Estranho não funcionar, fez tudo certo? Colocou no lado certo? 1 DID I HELP YOU? ________________________________________________________________________ ム MY STEAM ________________________________________________________________________ MY SITE www.tommy.br.com
DNL291 Posted December 19, 2019 Posted December 19, 2019 Vê se no debug mostra algum erro e você pode testar se o evento onPlayerChat desse resource está sendo chamado colocando alguma output no código, faça o mesmo no lado cliente. Se não conseguir fazer funcionar mostre aqui o arquivo meta. 1 Please do not PM me with scripting related question nor support, use the forums instead.
Niick Posted December 19, 2019 Author Posted December 19, 2019 13 hours ago, DNL291 said: Vê se no debug mostra algum erro e você pode testar se o evento onPlayerChat desse resource está sendo chamado colocando alguma output no código, faça o mesmo no lado cliente. Se não conseguir fazer funcionar mostre aqui o arquivo meta. Vou testar pelo debugscript
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