Author Topic: Say (or Chat) Sound Script doesn't work correctly  (Read 3481 times)

0 Members and 1 Guest are viewing this topic.

Offline pote_

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Say (or Chat) Sound Script doesn't work correctly
« on: May 04, 2016, 05:11:13 AM »
Hi. I want to get  chat sounds in my own gmod server.Then i found this topic and code here

Code: [Select]
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)
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