ZeyadGTX Posted June 22, 2014 Share 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 ) Link to comment
Max+ Posted June 23, 2014 Share 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 ) Link to comment
Et-win Posted June 23, 2014 Share 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. Link to comment
Moderators IIYAMA Posted June 24, 2014 Moderators Share 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. Link to comment
Et-win Posted June 24, 2014 Share 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. Link to comment
ZeyadGTX Posted June 24, 2014 Author Share 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 ) Link to comment
Max+ Posted June 24, 2014 Share Posted June 24, 2014 are you sure chat.mp3 is not inside a file , ? and show meta.xml Link to comment
ZeyadGTX Posted June 24, 2014 Author Share Posted June 24, 2014 "" description="teamsoundT" info="mod" type="misc" version="1.0.5" /> Link to comment
Et-win Posted June 24, 2014 Share Posted June 24, 2014 Where is the client file in meta? Link to comment
Max+ Posted June 24, 2014 Share 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, Link to comment
ZeyadGTX Posted June 24, 2014 Author Share Posted June 24, 2014 Look "0" description="" info="mod" type="misc" version="1.0.5" /> Link to comment
ZeyadGTX Posted June 24, 2014 Author Share 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) Link to comment
Et-win Posted June 24, 2014 Share Posted June 24, 2014 type="misc" has to be script btw. Link to comment
Max+ Posted June 24, 2014 Share 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 Link to comment
ZeyadGTX Posted June 25, 2014 Author Share 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 Link to comment
#DRAGON!FIRE Posted June 25, 2014 Share 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 ) 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