Niick Posted December 18, 2019 Share 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 ) Link to comment
SetMarcos Posted December 18, 2019 Share 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 ) Link to comment
Niick Posted December 18, 2019 Author Share 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 Link to comment
Other Languages Moderators Lord Henry Posted December 18, 2019 Other Languages Moderators Share 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 Link to comment
Niick Posted December 18, 2019 Author Share 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 Link to comment
Tommy. Posted December 18, 2019 Share 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 Link to comment
DNL291 Posted December 19, 2019 Share 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 Link to comment
Niick Posted December 19, 2019 Author Share 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 Link to comment
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