Fire Monkey Posted September 21, 2020 Share Posted September 21, 2020 Hi guys, I make spy mode for admin. I using onClientChatMessage function for get chat box from favorite player, but i want know is method are normal and optimized ? Server side: addCommandHandler("spy", function (player, command, target) if target then local ppl = getPlayerFromName(target) if ppl then setElementData(ppl, "spy", thePlayer) outputChatBox("Enabled on: "..getPlayerName(ppl).."", player, 255, 255, 255) end else outputChatBox("USAGE: /"..command.." <Player-Name>", player, 255, 255, 255) end end) addEvent("spy:ShowChat", true) addEventHandler("spy:ShowChat", root, function (root, message) local spy = getElementData(root, "spy") if spy then outputChatBox("[SPY-Mode] "..getPlayerName(root)..": "..message, spy, 255, 255, 255) end end) Client side: local lastMessage = nil addEventHandler("onClientChatMessage", getRootElement(), function (message) if not getElementData(getLocalPlayer(), "spy") then return false end if message == "" or message == " " then if lastMessage == message then return end end lastMessage = message triggerServerEvent("spy:ShowChat", getLocalPlayer(), getLocalPlayer(), message) end) And i want unlimited admin can active on player and see chat box. Do you have idea? Link to comment
RekZ Posted September 23, 2020 Share Posted September 23, 2020 All the chat system is Server side for what i known, why you dont get the chat in the server side ? Sending the client's information to the server is an inefficient in this case i think. Link to comment
xPeacefulDreams Posted September 24, 2020 Share Posted September 24, 2020 Could you explain what you exactly mean by Spy Mode and what you are trying to listen in to? I can imagine you're trying to read the private messages or something? I guess the question is, what are you trying to monitor? When the player sends a message/chat, or when the player receives a message/chat from someone else? Link to comment
Fire Monkey Posted September 26, 2020 Author Share Posted September 26, 2020 On 24/09/2020 at 02:33, RekZ said: All the chat system is Server side for what i known, why you dont get the chat in the server side ? Sending the client's information to the server is an inefficient in this case i think. It is not possible to receive messages sent to the player from the server side. On 24/09/2020 at 12:28, xPeacefulDreams said: Could you explain what you exactly mean by Spy Mode and what you are trying to listen in to? I can imagine you're trying to read the private messages or something? I guess the question is, what are you trying to monitor? When the player sends a message/chat, or when the player receives a message/chat from someone else? I want to check when a chat box is sent to the player. Link to comment
MTA Anti-Cheat Team Dutchman101 Posted September 26, 2020 MTA Anti-Cheat Team Share Posted September 26, 2020 (edited) It's still not clear what you are trying to do, and I think it's due to the language barrier. On your server gamemode, what types of chat output are only shown to the players themselves, and not globally? For example: PM, local chat, team chat, any interfaces that people can talk to others with? I would advise to implement logging for each of them, and if it can't wait (in the case of OutputServerLog not being enough, your admins really need to have it at their immediate disposal) to make a window that records all of such communication and in which your admins can filter by player name to see all of it for a specific player. Edited September 26, 2020 by Dutchman101 Link to comment
Fire Monkey Posted September 26, 2020 Author Share Posted September 26, 2020 3 hours ago, Dutchman101 said: It's still not clear what you are trying to do, and I think it's due to the language barrier. On your server gamemode, what types of chat output are only shown to the players themselves, and not globally? For example: PM, local chat, team chat, any interfaces that people can talk to others with? I would advise to implement logging for each of them, and if it can't wait (in the case of OutputServerLog not being enough, your admins really need to have it at their immediate disposal) to make a window that records all of such communication and in which your admins can filter by player name to see all of it for a specific player. I always use outputChatBox and I have no custom function. I want to see chat box sent to a specific player. Link to comment
MrLoKi Posted November 6, 2021 Share Posted November 6, 2021 Hello Fire Monkey ! There is a problem with your code (No chat is sent when we run Command) Please send me the complete code you wrote 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