Error:
[2017-12-28 09:08:30] WARNING: chat/server.lua:44: Bad argument @ 'getElementPosition' [Expected element at argument 1, got nil]
[2017-12-28 09:08:30] WARNING: chat/server.lua:45: Bad argument @ 'getPlayerName' [Expected element at argument 1, got nil]
[2017-12-28 09:08:30] WARNING: chat/server.lua:55: Bad argument @ 'addEventHandler' [Expected function at argument 3, got none]
Code:
local chat_tavolsag = 100
function onChat(player, _, msg)
local X, Y, Z = getElementPosition(player)
local nev = getPlayerName(player)
for _, v in ipairs(getElementsByType("player")) do
if messageType == 0 then
if isPlayerInRangeOfPoint(v, X, Y, Z, chat_tavolsag) then
outputChatBox("".. nev .." mondja: ".. msg .."", v, 255, 255, 255, true)
end
end
end
end
addEventHandler("onPlayerChat", getRootElement(), onChat(player, _, messsage))
Please help, i want a local chat.