Jump to content

Music doesn't start


FSXTim

Recommended Posts

When one of for RadioButtons get selected, and a player press the 'Start Party' button, music has to start, but it doesn't.

serverside:

function Music1 ( ) 
    local name = getPlayerName ( source ) 
    outputChatBox ( name.." hat den Party-Knopf gedrückt!", getRootElement(), 0, 255, 255 ) 
    triggerClientEvent ( "playTheSound1", root ) 
end 
addEvent ( "Music1", true ) 
addEventHandler ( "Music1", getRootElement(), Music1 ) 
  
function Music2 ( ) 
    local name = getPlayerName ( source ) 
    outputChatBox ( name.." hat den Party-Knopf gedrückt!", getRootElement(), 0, 255, 255 ) 
    triggerClientEvent ( "playTheSound2", root ) 
end 
addEvent ( "Music2", true ) 
addEventHandler ( "Music2", getRootElement(), Music2 ) 
  
function Music3 ( ) 
    local name = getPlayerName ( source ) 
    outputChatBox ( name.." hat den Party-Knopf gedrückt!", getRootElement(), 0, 255, 255 ) 
    triggerClientEvent ( "playTheSound3", root ) 
end 
addEvent ( "Music3", true ) 
addEventHandler ( "Music3", getRootElement(), Music3 ) 
  
function Music4 ( ) 
    local name = getPlayerName ( source ) 
    outputChatBox ( name.." hat den Party-Knopf gedrückt!", getRootElement(), 0, 255, 255 ) 
    triggerClientEvent ( "playTheSound4", root ) 
end 
addEvent ( "Music4", true ) 
addEventHandler ( "Music4", getRootElement(), Music4 ) 

clientside:

function startMusic ( state ) 
    if ( state == "left" ) then 
        if guiRadioButtonGetSelected( GUIEditor_Radio[10] ) then         
            if ( source == GUIEditor_Button[13] ) then 
                triggerServerEvent ( "Music1", localPlayer ) 
                addEvent ( "playTheSound1", true )   
            end      
        elseif guiRadioButtonGetSelected( GUIEditor_Radio[11] ) then         
            if ( source == GUIEditor_Button[13] ) then 
                triggerServerEvent ( "Music1", localPlayer ) 
                addEvent ( "playTheSound2", true )   
            end  
        elseif guiRadioButtonGetSelected( GUIEditor_Radio[12] ) then         
            if ( source == GUIEditor_Button[13] ) then 
                triggerServerEvent ( "Music1", localPlayer ) 
                addEvent ( "playTheSound3", true )   
            end  
        elseif guiRadioButtonGetSelected( GUIEditor_Radio[13] ) then         
            if ( source == GUIEditor_Button[13] ) then 
                triggerServerEvent ( "Music1", localPlayer ) 
                addEvent ( "playTheSound4", true )   
            end              
        end  
    end 
end  
addEventHandler ( "onClientGUIClick", getRootElement(), startMusic ) 
  
addEventHandler ( "playTheSound1", root, 
    function () 
        song1 = playSound ( "music/everything.mp3", false ) 
        setSoundVolume ( song1, 1 ) 
    end 
) 
  
addEventHandler ( "playTheSound2", root, 
    function () 
        song2 = playSound ( "music/party.mp3", false ) 
        setSoundVolume ( song2, 1 ) 
    end 
) 
  
addEventHandler ( "playTheSound3", root, 
    function () 
        song3 = playSound ( "music/ibiza.mp3", false ) 
        setSoundVolume ( song3, 1 ) 
    end 
) 
  
addEventHandler ( "playTheSound4", root, 
    function  () 
        song4 = playSound ( "music/writing.mp3", false ) 
        setSoundVolume ( song4, 1 ) 
    end 
) 

Can anybody help me?

Greets

Edited by Guest
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...