Jump to content

some help with gui


Machine

Recommended Posts

hello whats error in this codes

Server Side

triggerClientEvent( 'playSound',root ) 
addEvent( 'playSound',true ) 
addEventHandler( 'playSound',root, 
    function( ) 
        playSound( "google.mp3" ) 
    end 
)    
  

Client

        aTab = {} 
        aTab.Tab = guiCreateTab ( "Radio", aTabPanel ) 
        aTab1.Radio = guiCreateButton ( 0.40, 0.0, 0.20, 0.10, "Warning Sound", true, aTab.Tab, "playSound" ) 
        if ( source == aTab1.Radio ) then triggerServerEvent ( playSound ) 

its just used to make button that when you click on it it trigger to server side and server side make sound

i only used that to make sound for all players

Link to comment

i tried it didnt work

server side

addEvent("c_playSound",true) 
addEventHandler("c_playSound",root, 
    function(google.mp3) 
        triggerClientEvent("c_playSound",root,google.mp3) -- trigger it for everyone 
    end 
) 
  

Client Side

        aTab7 = {} 
        aTab7.Tab = guiCreateTab ( "Radio", aTabPanel ) 
        aTab1.Radio = guiCreateButton ( 0.40, 0.0, 0.20, 0.10, "Warning Sound", true, aTab7.Tab, "playSound" ) 
        if ( source == aTab1.Radio ) then triggerServerEvent("c_playSound",localPlayer,google.mp3) 
        addEvent("c_playSound",true) 
addEventHandler("c_playSound",root, 
    function(google.mp3) 
        playSound(google.mp3) -- now its played for everyone. 
     
    end 
) 
  
  

Link to comment

of course not works because you did not added the sound path , and its return as nil or false

server side

addEvent("c_playSound",true) 
addEventHandler("c_playSound",root, 
    function(sound) 
        triggerClientEvent("c_playSound",root,sound) -- trigger it for everyone 
    end 
) 

client side

      aTab7 = {} 
        aTab7.Tab = guiCreateTab ( "Radio", aTabPanel ) 
        aTab1.Radio = guiCreateButton ( 0.40, 0.0, 0.20, 0.10, "Warning Sound", true, aTab7.Tab, "playSound" ) 
        if ( source == aTab1.Radio ) then  
        sound = "google.mp3" 
        triggerServerEvent("c_playSound",localPlayer,sound) 
        addEvent("c_playSound",true) 
addEventHandler("c_playSound",root, 
    function(sound) 
        playSound(sound) -- now its played for everyone. 
    
    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...