ZeyadGTX Posted June 22, 2014 Posted June 22, 2014 Hey Guys , i have script which make sound in chat , but i have something i want this sounds Plays onTeamChat only because it plays on Any Chat Client function playSonido() local sound = playSound("chat.mp3",false) setSoundVolume(sound, 0.9) end addEvent("sonido",true) addEventHandler("sonido",getRootElement(),playSonido) Server function chat (thePlayer) triggerClientEvent("sonido",getRootElement()) end addEventHandler ( "onPlayerChat", getRootElement(), chat )
Max+ Posted June 23, 2014 Posted June 23, 2014 Next Time , Make sure your in the Scripting Section , addEventHandler('onPlayerChat', root, function ( msg, msgType ) if ( msgType == 2 ) then triggerClientEvent(source, 'Play', source ) end end ) ---ServerSide addEvent('Play', true ) addEventHandler('Play', root, function ( ) local sound = playSound("chat.mp3" ) setSoundVolume(sound, 1.0) end )
Et-win Posted June 23, 2014 Posted June 23, 2014 We have helped you with 2 scripts for teamchat already and still you don't know it? Look into the scripts we have 'helped' you with and go understand it. I think you are not even taking time to look into it.
Moderators IIYAMA Posted June 24, 2014 Moderators Posted June 24, 2014 We have helped you with 2 scripts for teamchat already and still you don't know it? Look into the scripts we have 'helped' you with and go understand it. I think you are not even taking time to look into it. Hij wil het ook niet, dit is alleen maar bedelen.
Et-win Posted June 24, 2014 Posted June 24, 2014 We have helped you with 2 scripts for teamchat already and still you don't know it? Look into the scripts we have 'helped' you with and go understand it. I think you are not even taking time to look into it. Hij wil het ook niet, dit is alleen maar bedelen. Yup.
ZeyadGTX Posted June 24, 2014 Author Posted June 24, 2014 Not Working , i added this to server side addEventHandler('onPlayerChat', root, function ( msg, msgType ) if ( msgType == 2 ) then triggerClientEvent(source, 'Play', source ) end end ) ---ServerSide addEvent('Play', true ) addEventHandler('Play', root, function ( ) local sound = playSound("chat.mp3" ) setSoundVolume(sound, 1.0) end )
Max+ Posted June 24, 2014 Posted June 24, 2014 are you sure chat.mp3 is not inside a file , ? and show meta.xml
ZeyadGTX Posted June 24, 2014 Author Posted June 24, 2014 "" description="teamsoundT" info="mod" type="misc" version="1.0.5" />
Max+ Posted June 24, 2014 Posted June 24, 2014 Make 2 lua file , file 1 - clientSide witch is the play sound , file 2 the server side , witch is the have triggerClient,
ZeyadGTX Posted June 24, 2014 Author Posted June 24, 2014 Look "0" description="" info="mod" type="misc" version="1.0.5" />
ZeyadGTX Posted June 24, 2014 Author Posted June 24, 2014 Server side addEventHandler('onPlayerChat', root, function ( msg, msgType ) if ( msgType == 2 ) then triggerClientEvent(source, 'Play', source ) end end ) ---ServerSide addEvent('Play', true ) addEventHandler('Play', root, function ( ) local sound = playSound("chat.mp3" ) setSoundVolume(sound, 1.0) end ) Client function playSonido() local sound = playSound("chat.mp3",false) setSoundVolume(sound, 0.9) end addEvent("sonido",true) addEventHandler("sonido",getRootElement(),playSonido)
Max+ Posted June 24, 2014 Posted June 24, 2014 this is serverSide , addEventHandler('onPlayerChat', root, function ( msg, msgType ) if ( msgType == 2 ) then triggerClientEvent(source, 'Play', source ) end end ) ClientSide , addEvent('Play', true ) addEventHandler('Play', root, function ( ) local sound = playSound("chat.mp3" ) setSoundVolume(sound, 1.0) end ) and change the misc to script
ZeyadGTX Posted June 25, 2014 Author Posted June 25, 2014 thanks , it works good but i have another question . i hear the sound when i send message i want to hear it when others send
#DRAGON!FIRE Posted June 25, 2014 Posted June 25, 2014 Client Side ! addEvent( "PlaySound", true ) addEventHandler( "PlaySound", root, function ( ) if ( isElement( sound ) ) then destroyElement( sound ) end local sound = playSound( "chat.mp3" ) setSoundVolume( sound, 1.0 ) end ) Server Side ! addEventHandler( "onPlayerChat", root, function ( msg, msgType ) if ( msg ~= "" and msgType == 2 ) then triggerClientEvent( "PlaySound", root ) end end )
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