Machine Posted August 10, 2012 Share Posted August 10, 2012 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
Sora Posted August 10, 2012 Share Posted August 10, 2012 lol the function playSound is Client-only function Link to comment
Machine Posted August 10, 2012 Author Share Posted August 10, 2012 how to fix? i need it server Link to comment
Sora Posted August 10, 2012 Share Posted August 10, 2012 (edited) this post may help you viewtopic.php?f=91&t=44657&p=447575#p447575 Edited August 10, 2012 by Guest Link to comment
Machine Posted August 10, 2012 Author Share Posted August 10, 2012 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
Sora Posted August 10, 2012 Share Posted August 10, 2012 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
Machine Posted August 10, 2012 Author Share Posted August 10, 2012 it gives lots of bugs man can you just make simple code that when you click on button tigger to server side thats all i want Link to comment
Sora Posted August 11, 2012 Share Posted August 11, 2012 lol , checkout my resource : https://community.multitheftauto.com/ind ... ls&id=4436 Link to comment
Machine Posted August 11, 2012 Author Share Posted August 11, 2012 Thanks alot its what i want Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now