Narutimmy Posted November 9, 2012 Share Posted November 9, 2012 Hola bueno lo que pasa es que quiero que al spawnear el slothbot se reproduca un sonido, primero me pase por la wiki y estube intentando tanto con el playsound como el 3d pero no funciono esto es lo que ise: function Bot ( ) local random = math.random ( #randomSpawnTable ) local x, y, z = unpack ( randomSpawnTable [ random ] ) slothbot = exports [ "slothbot" ]:spawnBot ( x, y, z, 90, 33, 0, 0, BOSS, 38, hunting, true ) exports.extra_health:setElementExtraHealth ( slothbot, 50000) outputChatBox ( "#ff0000Nemesis: #eeff00S.T.A.R.S!!!", getRootElement(), 255, 255, 255, true ) playSound("nemesis.mp3") end addEventHandler ( "onResourceStart", resourceRoot, Bot ) setTimer(Bot,1800000,0) Link to comment
Castillo Posted November 9, 2012 Share Posted November 9, 2012 Eso es porque es una funcion client side, y el script tuyo es server side. Tenes que usar: triggerClientEvent -- server side: function Bot ( ) local random = math.random ( #randomSpawnTable ) local x, y, z = unpack ( randomSpawnTable [ random ] ) slothbot = exports [ "slothbot" ]:spawnBot ( x, y, z, 90, 33, 0, 0, BOSS, 38, hunting, true ) exports.extra_health:setElementExtraHealth ( slothbot, 50000 ) outputChatBox ( "#ff0000Nemesis: #eeff00S.T.A.R.S!!!", getRootElement(), 255, 255, 255, true ) triggerClientEvent ( "playTheSound", root ) end addEventHandler ( "onResourceStart", resourceRoot, Bot ) setTimer ( Bot, 1800000, 0 ) -- client side: addEvent ( "playTheSound", true ) addEventHandler ( "playTheSound", root, function ( ) playSound ( "nemesis.mp3" ) end ) Link to comment
Narutimmy Posted November 9, 2012 Author Share Posted November 9, 2012 Eso es porque es una funcion client side, y el script tuyo es server side.Tenes que usar: triggerClientEvent -- server side: function Bot ( ) local random = math.random ( #randomSpawnTable ) local x, y, z = unpack ( randomSpawnTable [ random ] ) slothbot = exports [ "slothbot" ]:spawnBot ( x, y, z, 90, 33, 0, 0, BOSS, 38, hunting, true ) exports.extra_health:setElementExtraHealth ( slothbot, 50000 ) outputChatBox ( "#ff0000Nemesis: #eeff00S.T.A.R.S!!!", getRootElement(), 255, 255, 255, true ) triggerClientEvent ( "playTheSound", root ) end addEventHandler ( "onResourceStart", resourceRoot, Bot ) setTimer ( Bot, 1800000, 0 ) -- client side: addEvent ( "playTheSound", true ) addEventHandler ( "playTheSound", root, function ( ) playSound ( "nemesis.mp3" ) end ) Antes se Dañaba el Scrip, pero asi como me lo pones no se daño, pero tampoco se Reproduce el Sonido Link to comment
Narutimmy Posted November 9, 2012 Author Share Posted November 9, 2012 Mostrame el meta.xml. "Narutimmy" version="0.1.9" name="Boss" description="Jefes de ZombiWorld" type="script" /> Link to comment
Castillo Posted November 9, 2012 Share Posted November 9, 2012 Donde pusiste: addEvent ( "playTheSound", true ) addEventHandler ( "playTheSound", root, function ( ) playSound ( "nemesis.mp3" ) end ) Link to comment
Narutimmy Posted November 9, 2012 Author Share Posted November 9, 2012 Donde pusiste: addEvent ( "playTheSound", true ) addEventHandler ( "playTheSound", root, function ( ) playSound ( "nemesis.mp3" ) end ) dentro de Porque es client, esta mal? Link to comment
Castillo Posted November 9, 2012 Share Posted November 9, 2012 Eso esta bien. Pero no va a funcionar, porque el script client side aun no cargo, y el server side ya intenta enviar el evento. Link to comment
Narutimmy Posted November 9, 2012 Author Share Posted November 9, 2012 Eso esta bien.Pero no va a funcionar, porque el script client side aun no cargo, y el server side ya intenta enviar el evento. Entonses no se va a poder? tendrian que estar los 2 en client? Link to comment
Castillo Posted November 9, 2012 Share Posted November 9, 2012 Y eso no es posible, porque los slothbot son server side. Link to comment
Narutimmy Posted November 9, 2012 Author Share Posted November 9, 2012 Y eso no es posible, porque los slothbot son server side. Que suerte ya Funciono ;D, con el primer spawn no funciona, pero como el slothbot se spawnea cada 10mins pues ya carga la otro y si se reproduce, gracias Link to comment
Castillo Posted November 9, 2012 Share Posted November 9, 2012 Si, por el timer. De nada. Link to comment
Recommended Posts