Javier Posted November 13, 2012 Posted November 13, 2012 Hola, tengo un problema con el resource ambience_sound de Yakuza. El problema es que se reproducen diferentes sonidos a los players. Es decir Yo escucho una de metal , mientras que otro player escucha otra. Yo quiero que todos escuchen la misma musica al mismo tiempo. Me yudan? Gracias local sounds = {"--aca los links en este caso"} function playsound() playSound(sounds[math.random(1, #sounds)]) setSoundVolume(sound, 300.0) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),playsound) setTimer(playsound, 410000,0)
Castillo Posted November 13, 2012 Posted November 13, 2012 Lo que podes hacer es cambiar para que envie las URL desde el server side a todos los jugadores, asi todos escucharian la misma cosa. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Javier Posted November 13, 2012 Author Posted November 13, 2012 Lo que podes hacer es cambiar para que envie las URL desde el server side a todos los jugadores, asi todos escucharian la misma cosa. Y como hago eso?
Castillo Posted November 13, 2012 Posted November 13, 2012 Cambias parte del script que tenes, el que genera la cancion aleatoria, luego la envias a todos los jugadores con: triggerClientEvent y ahi agregas ese evento en el client side con: addEvent addEventHandler San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Javier Posted November 13, 2012 Author Posted November 13, 2012 Y entonces como queda esta parte. La verdad no nose playSound(sounds[math.random(1, #sounds)])
Castillo Posted November 13, 2012 Posted November 13, 2012 Pones ahi la URL que enviaste desde el servidor. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Javier Posted November 13, 2012 Author Posted November 13, 2012 Pones ahi la URL que enviaste desde el servidor. Lo hice asi client local sounds = {"las urls"} function playsound() playSound(sounds[math.random(1, #sounds)]) setSoundVolume(sound, 300.0) end addEvent("musica", true ) addEventHandler("musica",getResourceRootElement(getThisResource()),playsound) setTimer(playsound, 410000,0) server function inicio () triggerClientEvent("musica", getRootElement(), playSound) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), inicio) Esta bien?
Castillo Posted November 13, 2012 Posted November 13, 2012 Eso no tiene sentido. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Javier Posted November 13, 2012 Author Posted November 13, 2012 Eso no tiene sentido. Cual es problema en el script?
Castillo Posted November 13, 2012 Posted November 13, 2012 Esta vez lo hice yo, pero la proxima no. -- client side: addEvent ( "musica", true ) addEventHandler ( "musica", root, function ( url ) if ( isElement ( sound ) ) then destroyElement ( sound ) end sound = playSound ( url ) setSoundVolume ( sound, 300 ) end ) -- server side: local sounds = { "las urls" } function inicio ( ) triggerClientEvent ( "musica", getRootElement(), sounds [ math.random ( #sounds ) ] ) end addEventHandler ( "onResourceStart", resourceRoot, inicio ) setTimer ( inicio, 410000, 0 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Javier Posted November 13, 2012 Author Posted November 13, 2012 Esta vez lo hice yo, pero la proxima no.-- client side: addEvent ( "musica", true ) addEventHandler ( "musica", root, function ( url ) if ( isElement ( sound ) ) then destroyElement ( sound ) end sound = playSound ( url ) setSoundVolume ( sound, 300 ) end ) -- server side: local sounds = { "las urls" } function inicio ( ) triggerClientEvent ( "musica", getRootElement(), sounds [ math.random ( #sounds ) ] ) end addEventHandler ( "onResourceStart", resourceRoot, inicio ) setTimer ( inicio, 410000, 0 ) Ah Gracias.
Castillo Posted November 13, 2012 Posted November 13, 2012 De nada. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Recommended Posts