function PlayChatSound(ply,text,team,death)
for k,v in pairs(ChatSounds) do
if string.find(string.lower(text),string.lower(k)) then
PlaySoundAll(v, ply.GetPos())
break
end
end
end
hook.Add("PlayerSay","PlayChatSound",PlayChatSound)
function PlaySound(path, player)
sound.Play(path, player)
end
As you can see here, I'm trying to get the current player position (of the player that calls the hook) and pass it to sound.Play. However, whenever I run this I get the following error:
[ERROR] lua/autorun/server/chatsound.lua:13: Tried to use a NULL entity!
1. GetPos - [C]:-1
2. fn - lua/autorun/server/chatsound.lua:13
3. unknown - addons/ulib-master/lua/ulib/shared/hook.lua:109
How could I fix this? Thank you in advance for any help.
ply.GetPos()
to
ply:GetPos()
It's a meta function
Sorry, you need to Log In to post a reply to this thread.