Jump to content

[help] Sound


Recommended Posts

Posted

I used this function to when I activate the command on a sound server starts,But when I'm using only I listen I want all players server hear the sound What do I add to when I use the command every listen online?

function cevent (thePlayer)  
    local sound = playSound("evcriado.mp3")  
    setSoundVolume(sound, 0.5)  
end 
  
addCommandHandler("cevent",cevent) 

Sorry my bad english I'm brasilian

HELP-ME

Posted (edited)
--Client 
function cevent () 
    if isElement(sound) then 
stopSound(sound) 
end 
    sound = playSound("evcriado.mp3") 
    setSoundVolume(sound, 0.5) 
end 
addEvent("onPlayerRequestSound", true) 
addEventHandler("onPlayerRequestSound", root, cevent) 
  
--Server 
function requestSound() 
triggerClientEvent("onPlayerRequestSound", root) 
end 
addCommandHandler("cevent", requestSound) 

Edited by Guest
Posted

Make sure to check, if the sound is there, and if it is, then destroy it, other wise you would be able to play the same song like 5 times @ the same time..

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...