GamerDeMTA Posted February 14, 2013 Posted February 14, 2013 Hi Guys, I need a script to, for example, when you write in the chat "wtf?", sounds a sound, and ALL can hear that sound. Is possible? Please. And How to add to my Server the script?
iPrestege Posted February 14, 2013 Posted February 14, 2013 "onPlayerChat" triggerClientEvent addEvent addEventHandler playSound
csiguusz Posted February 14, 2013 Posted February 14, 2013 Also possible only on client-side (without triggerClientEvent) : onClientChatMessage playSound
GamerDeMTA Posted February 14, 2013 Author Posted February 14, 2013 "onPlayerChat" triggerClientEvent addEvent addEventHandler playSound But What I shall do with that code? Okay, Put it in a .lua, and how to add the words? And the sound? And If i want more than 1 sound? and Thanks!!! And I must put some lines in any XML, or anything smilar? SORRY FOR MY BAD ENGLISH
csiguusz Posted February 14, 2013 Posted February 14, 2013 Yes, I can read. Every single client gets the chat messages and can play a sound if it contains "wtf" for example.
iPrestege Posted February 14, 2013 Posted February 14, 2013 Full Script Just Create Lua Files And META.XML And Add The Sound To The Meta And Here You Are The Code : Client Script : function ClientSide() playSound ("Name.mp3") end addEvent("Client",true, ClientSide ) addEventHandler("Client",root, ClientSide ) Server Script : addEventHandler("onPlayerChat", root, function ( msg ) if msg == "wtf" then triggerClientEvent ("Client",root) end end) Meta.Xml : "Name.mp3" /> Have Fun
GamerDeMTA Posted February 14, 2013 Author Posted February 14, 2013 Full Script Just Create Lua Files And META.XML And Add The Sound To The Meta And Here You Are The Code :Client Script : function ClientSide() playSound ("Name.mp3") end addEvent("Client",true, ClientSide ) addEventHandler("Client",root, ClientSide ) Server Script : addEventHandler("onPlayerChat", root, function ( msg ) if msg == "wtf" then triggerClientEvent ("Client",root) end end) Meta.Xml : "Name.mp3" /> Have Fun Thanks to all, you were very kind with me
iPrestege Posted February 14, 2013 Posted February 14, 2013 No Problem Just Test It And Tell Me The Results .
GamerDeMTA Posted February 14, 2013 Author Posted February 14, 2013 No Problem Just Test It And Tell Me The Results . I put the scripts in a .RAR, and The Console when I start it says "Resource could not be found" /The .RAR Is in Resources
Castillo Posted February 14, 2013 Posted February 14, 2013 Resources can only be either folders or zip files.
Shazzimal Posted February 15, 2013 Posted February 15, 2013 Thanks for that, that was a problem for me, i always set i in rar, haha
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