Narutimmy Posted November 9, 2012 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) mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
Castillo Posted November 9, 2012 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Narutimmy Posted November 9, 2012 Author 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 mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
Castillo Posted November 9, 2012 Posted November 9, 2012 Mostrame el meta.xml. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Narutimmy Posted November 9, 2012 Author Posted November 9, 2012 Mostrame el meta.xml. "Narutimmy" version="0.1.9" name="Boss" description="Jefes de ZombiWorld" type="script" /> mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
Castillo Posted November 9, 2012 Posted November 9, 2012 Donde pusiste: addEvent ( "playTheSound", true ) addEventHandler ( "playTheSound", root, function ( ) playSound ( "nemesis.mp3" ) end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Narutimmy Posted November 9, 2012 Author Posted November 9, 2012 Donde pusiste: addEvent ( "playTheSound", true ) addEventHandler ( "playTheSound", root, function ( ) playSound ( "nemesis.mp3" ) end ) dentro de Porque es client, esta mal? mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
Castillo Posted November 9, 2012 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Narutimmy Posted November 9, 2012 Author 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? mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
Castillo Posted November 9, 2012 Posted November 9, 2012 Y eso no es posible, porque los slothbot son server side. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Narutimmy Posted November 9, 2012 Author 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 mtasa://66.85.14.178:22003 Ts3: thezombiworld.com:7777
Castillo Posted November 9, 2012 Posted November 9, 2012 Si, por el timer. 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