General > Off-Topic
Say (chat ) Sounds in Gmod 10
WW3D:
Is there a way to get say (chat) sounds in Gmod 10? In other words a player types 'hi' in chat, and the server sends a command to all clients to play the sound hi.wav for example. I am pushing the sounds to the client using ULX, and I can trigger a sound to play by typing this is console "ulx playsound folderx/soundx.wav". I'm currently running ULX 3.31 and Assmod, but am unable to find a way to do this. I also tried installing Metamod 1.62 (hoping to be able to get Mani's running on top of it), which I've done before on other servers, but no luck with Gmod 10. I've searched these forums pretty thoroughly and found references to a way to do it under legacy versions of ULX and Ulib. But when I try what is suggested in those posts, nothing happens, no sound is triggered.
So to sum up the above, can someone recommend a way to accomplish chat sounds whether it be in ULX or any other Admin mod that works with current Gmod 10 dedicated server running on Windows.
Appreciate any insights you can offer.
jay209015:
Here you go :D
--- Code: ---USay = {}
USay.WordList = {
["hi"] = "sound/hi.wav";
}
function USay.ChatFunction( ply, text )
if ply:IsValid() then
for k,v in pairs(USay.WordList) do
if string.find( text, k ) then
game.ConsoleCommand("ulx playsound " ..USay.WordList[k].. "\n")
return text
end
end
end
end
hook.Add("PlayerSay", "USay.ChatFunction_Hook", USay.ChatFunction)
--- End code ---
For the word list, just insert a ["word"] = "sound location";
Not tested yet, let me know if it works. Save as USay.lua and place it in your servers' lua/autorun
[[EDIT - JamminR] - Fixed syntax error
WW3D:
Hi,
Thanks for the quick reply! OK, if I place it in lua/autorun I don't see anything in console to show that it loaded, and it doesn't seem to work. If I place it lua/autorun/server or addons/ulx/lua/modules/ it does try to load it, but then I get this when server starts up.
--- Code: ---autorun/server/USay.lua:8: function arguments expected near 'then'
--- End code ---
JamminR:
Simple syntax mistake.
ply:IsValid should be ply:IsValid()
I've edited the original post.
WW3D:
Thanks guys! I will try this out tonight when I have some time to dig in. :)
Edit: Ok I tried out the updated corrected syntax JamminR posted, but now I'm getting this.
--- Code: ---Error, bad server command ulx playsound sound/ww3d/what1.wav/n
--- End code ---
Btw, I tried out the Exosounds plugin I found today, and it is pretty much doing what I was looking for, so no biggie if this doesn't work out, though I certainly appreciate the effort! It's not perfect as the admin only sounds can still be triggered by anyone, but at least it gets the job done.
Navigation
[0] Message Index
[#] Next page
Go to full version