Jump to content

Sound problem :p


-.Paradox.-

Recommended Posts

Hello i need some help here when i click the play bouton it dont play the radio

addEventHandler("onClientGUIClick", guiRoot, 
function() 
    if source == GUIEditor.button[1] then 
        local row = guiGridListGetSelectedItem(GUIEditor.gridlist[1]) 
        if row == 0 then 
              function radio( ) 
                 for i,v in ipairs( getElementsByType( "player" ) ) do 
                 local x, y, z = getElementPosition( v ); 
                 local playButton = playSound3D( 'http://www.181.fm/playing.php?station=181-party&embed=1')  
                 setSoundMaxDistance( playButton, 100 ) 
              end 
        end 
    end 
end 
end) 

Link to comment

Can't understand?

You mean like that?

Here is my server side script

addEvent("firstSound", true) 
addEventHandler("firstSound", root, 
function( ) 
     for i,v in ipairs( getElementsByType( "player" ) ) do 
     local x, y, z = getElementPosition( v ); 
     local playButton = playSound( 'http://www.181.fm/playing.php?station=181-party&embed=1')  
     setSoundMaxDistance( playButton, 100 ) 
     end 
     end) 
addEvent("firstSoundStop", true) 
addEventHandler("firstSoundStop", root, 
function ( ) 
    if(isSoundPaused(playButton)) then --sound is paused, un-pause it 
    setSoundPaused(playButton, false) 
    else --sound is not paused, pause it 
    setSoundPaused(playButton, true) 
    end 
end) 

Link to comment
-- Client 
addEventHandler ("onClientGUIClick", root, function ( ) 
    if ( source == GUIEditor.button[1] ) then 
        local row, col = guiGirdListGetSelectedItem ( GUIEditor.gridlist[1] ) 
        if ( row ~= -1 and col ~= 0 ) then 
            radio ( ) 
        end 
    end 
end ) 
  
function radio ( ) 
    triggerServerEvent ( "StartTheSound", localPlayer ) 
end 
  
addEvent ( "StartTheSound_C", true ) 
addEventHandler ( "StartTheSound_C", root, function ( ) 
    if not isElement ( sound ) then 
        local x, y, z = getElementPosition ( localPlayer ) 
        sound = playSound3D( 'http://www.181.fm/playing.php?station=181-party&embed=1', x, y, z ) 
    end 
end ) 
  
-- Server 
addEvent ( "StartTheSound", true ) 
addEventHandler ( "StartTheSound", root, function ( ) 
    triggerClientEvent ( root, "StartTheSound_C", root ) 
end ) 

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