Jump to content

[Ayuda] Sonido al Spawnear SlothBot


Narutimmy

Recommended Posts

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

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
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
  • Recently Browsing   0 members

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