General > Off-Topic

Say (or Chat) Sound Script doesn't work correctly

(1/3) > >>

pote_:
Hi. I want to get  chat sounds in my own gmod server.Then i found this topic and code here


--- 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 ---
https://forums.ulyssesmod.net/index.php?topic=3762.0

I installed correctly but some sounds won't be played correctly. For example when I type "apple", somehow "a.mp3" be played even if "apple.mp3" exists.
I wrote "usay.lua" correctly. I guess the script doing this. But I have no idea to solve this...
Someone help me please.
Thank you and sorry for my broken english

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given

[0] Board index

Go to full version