Mimimiguel Posted August 25, 2011 Posted August 25, 2011 Is there any way to do this? In my radio system only the one who's playing it can hear the sound, so, is there any way to make everyone hear it? Thanks Canal de Youtube Bayside RP
Fabio(GNR) Posted August 25, 2011 Posted August 25, 2011 To be clear, you want to create a sound in GTA world or doesnt it matter were the sound's located? If you really want to use 3D ( compare: https://wiki.multitheftauto.com/wiki/PlaySound3D , https://wiki.multitheftauto.com/wiki/PlaySound ) then create it for every player, everything you create client-side is only for the client your executing it "at". So only he/she will notice something created. Creating for everyone: trigger a client event for all players. If you reply, i'll go more detailed. LuaCompiler United Social Gamers [ CnR / DD / DM & more ]
Mimimiguel Posted August 25, 2011 Author Posted August 25, 2011 Yes, please, i think i take the idea but im not sure of how can i create a sound for everyone in clientside starting of a gui event. The idea its to use the playSound3D function, so when another player gets nearly the sound he can hear it. Canal de Youtube Bayside RP
JR10 Posted August 25, 2011 Posted August 25, 2011 client: addEvent ( "playSoundForAllPlayers" , true) addEventHandler("playSoundForAllPlayers", root, function() playSound3D(...) end) And in server, use this whenever you want to play the sound. triggerClientEvent("playSoundForAllPlayers", root) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Mimimiguel Posted August 25, 2011 Author Posted August 25, 2011 Yes, but the event starts from a gui so what should i do? trigger the event from the gui to the server and then trigger it again to the client? Canal de Youtube Bayside RP
JR10 Posted August 25, 2011 Posted August 25, 2011 Yes. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
bandi94 Posted August 25, 2011 Posted August 25, 2011 yes Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Mimimiguel Posted August 25, 2011 Author Posted August 25, 2011 Lets try it, ill post the results, thanks for the help. Canal de Youtube Bayside RP
Mimimiguel Posted August 26, 2011 Author Posted August 26, 2011 Well, the sync worked fine but I had another bug that i still couldnt solve: sound = {} addEvent( "playsound", true ) addEventHandler( "playsound", getRootElement(), function( veh, sound, player ) if getElementData( player, "radio" ) == false then x, y, z = getElementPosition( veh ) sound[ player ] = playSound3D( sound, x, y, z, false ) setTimer( actualizarPosicionSonido, 50, 0, sound, veh ) setSoundMaxDistance( sound, maxdistance ) setElementData( player, "radio", true ) else stopSound( sound[ player ] ) sound[ player ] = nil setElementData( player, "radio", false ) end end ) Returns: Attempt to index local 'sound' ( a string value ) Canal de Youtube Bayside RP
JR10 Posted August 26, 2011 Posted August 26, 2011 playSound3D( sound, x, y, z, false ) sound should be a table, and your using it in playSound3D, and you defined it as string before. Edit playSound3D and replace sound with the file path. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Mimimiguel Posted August 26, 2011 Author Posted August 26, 2011 playSound3D( sound, x, y, z, false ) sound should be a table, and your using it in playSound3D, and you defined it as string before. Edit playSound3D and replace sound with the file path. So instead of playSound3D( sound, x, y, z, false ) it should be for example playSound3D( "sound.mp3", x, y, z, false) ? Canal de Youtube Bayside RP
JR10 Posted August 26, 2011 Posted August 26, 2011 Yes. And if there is any local sound exept sound = {} remove it also setSoundMaxDistance( sound, maxdistance ) should be: setSoundMaxDistance( sound [ player ], maxdistance ) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Mimimiguel Posted August 26, 2011 Author Posted August 26, 2011 Did it and worked fine, thanks! Canal de Youtube Bayside RP
JR10 Posted August 26, 2011 Posted August 26, 2011 You welcome. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
H5N1 Posted August 26, 2011 Posted August 26, 2011 My script (https://community.multitheftauto.com/index.php?p= ... ls&id=2585) use it, so you can look at code and learn how to synchronize it.
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