Jump to content

playSound Truoble!


Klesh

Recommended Posts

Hi community, i try to make a simple script, this script play's a sound with a command, the song play's for all!

The code doesn't works.

local root = getRootElement () 
function playXSSoundForPlayer(forAll) 
    if (forAll) then 
        playSound("/music/XS.mp3",false)     
    else 
        if (source == localPlayer) then 
            playSound("/music/XS.mp3",false) 
        else 
            local x,y,z = getElementPosition(source) 
            local sound = playSound3D("/music/XS.mp3",x,y,z,false) 
            setSoundMinDistance(sound,5) 
            setSoundMaxDistance(sound,40) 
            attachElements(sound,source) 
        end 
    end 
end 
addEvent("onPlayerPlayXSSound", true) 
addEventHandler("onPlayerPlayXSSound", root, playXSSoundForPlayer) 
addCommandHandler( "playsound", playXSSoundForPlayer ) 

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