Normand Posted December 28, 2017 Share Posted December 28, 2017 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. Link to comment
Normand Posted December 28, 2017 Author Share Posted December 28, 2017 So i tried to make a local chat based on the basic mta chat function (The T Bind) but it does not work because i think the mta basic chat overwrites my script. Link to comment
Melbourne Posted December 28, 2017 Share Posted December 28, 2017 local chat_tavolsag = 100 function onChat( msg, messagetype ) local X, Y, Z = getElementPosition(source) local nev = getPlayerName(source) 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) Link to comment
Normand Posted December 29, 2017 Author Share Posted December 29, 2017 (edited) My new problem, double messages. Default chat and my chat. Richard Norrington: asd Richard Norrington mondja: asd Code: local chat_tavolsag = 100 function onChat(msg, messageType) local X, Y, Z = getElementPosition(source) local nev = getPlayerName(source) for _, v in ipairs(getElementsByType("player")) do if messageType == 0 then cancelEvent() if isPlayerInRangeOfPoint(v, X, Y, Z, chat_tavolsag) then outputChatBox("".. nev .." mondja: ".. msg .."", v, 255, 255, 255, true) end end end end addEventHandler("onPlayerChat", root, onChat) Edited December 29, 2017 by Normand Link to comment
Normand Posted December 29, 2017 Author Share Posted December 29, 2017 Please help, someone. Link to comment
Melbourne Posted December 29, 2017 Share Posted December 29, 2017 Stop freeroam resource Link to comment
Normand Posted December 29, 2017 Author Share Posted December 29, 2017 it is works thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now