Jump to content

playSound


Recommended Posts

How can I broadcast a 'playSound' to everybody in the server? Is this possible & how can I accomplish this?

Trigger a client event from server for everybody, which is attached to playSound.

Client:

addEvent("broadcast playSound", true) 
addEventHandler("broadcast playSound", root, playSound) 

Server:

triggerClientEvent(root, "broadcast playSound", resourceRoot, "sound URL", loop) 

Link to comment

Ed:This is My Code. should on working

Client - side

    addEventHandler("onClientResourceStart", root, 
    function() 
    triggerServerEvent("start", getLocalPlayer()) 
    end 
    ) 
     
    addEvent("song", true) 
    addEventHandler("song", root, function(player) 
    stream = playSound(tostring(player)) 
    end 
    ) 

Server - side

  
addEvent("start", true) 
addEventHandler("start",root, 
function() 
        sound = "http://www.mtaturk.net/upload/uploads/Fast%20Furious%204%20SoundTrack%20-%20Krazy%20PitBull%20ft%20Lil%20Jon%20HD%20720p.mp3" 
        triggerClientEvent("song", resourceRoot, sound) 
    end 
) 
  

Link to comment
  • 3 weeks later...
How can I broadcast a 'playSound' to everybody in the server? Is this possible & how can I accomplish this?

specifiy a sound element then triggerClientEvent for all the players in the server by using getElementsByTtype("player") and loop them, so it's sent to all the players in the server

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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