Jump to content

[Ayuda] Sonido al Spawnear SlothBot


Narutimmy

Recommended Posts

Posted

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

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Mostrame el meta.xml.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Mostrame el meta.xml.
    "Narutimmy" version="0.1.9" name="Boss" description="Jefes de ZombiWorld" type="script" /> 
     
    

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Donde pusiste:

addEvent ( "playTheSound", true ) 
addEventHandler ( "playTheSound", root, 
    function ( ) 
        playSound ( "nemesis.mp3" ) 
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Y eso no es posible, porque los slothbot son server side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Si, por el timer.

De nada.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...