Turbe$Z Posted March 22, 2024 Posted March 22, 2024 (edited) hey, i made a custom chat script, and i want to output every message to that, and i found this event, but does not work... i tried it this way: function onChatMessageHandler(theMessage, thePlayer) --outputChatBox(theMessage) triggerClientEvent(root,"chat->NewMessage",root,false,theMessage) end addEventHandler("onChatMessage", root, onChatMessageHandler) what wrong, or how to use? there is no errors or warnings, simply just does not trigger the client event Edited March 22, 2024 by Turbe$Z
WWW Posted March 22, 2024 Posted March 22, 2024 We have this event on client. https://wiki.multitheftauto.com/wiki/OnClientChatMessage 1
Turbe$Z Posted March 22, 2024 Author Posted March 22, 2024 2 minutes ago, WWW said: We have this event on client. https://wiki.multitheftauto.com/wiki/OnClientChatMessage umm this is works with all outputs. but if an output is for only local player on the server side, it will not appear to everyone? or the opposite, if a output for everyone, it will not show only for local player?
WWW Posted March 22, 2024 Posted March 22, 2024 You have to select the message, then cancel the event.
Turbe$Z Posted March 22, 2024 Author Posted March 22, 2024 3 minutes ago, WWW said: You have to select the message, then cancel the event. what do you mean?
WWW Posted March 22, 2024 Posted March 22, 2024 (edited) Client: addEventHandler("onClientChatMessage", root, function() if getElementData(source, "chat") == "local" then if source ~= getLocalPlayer() then cancelEvent() end end end) Server: setElementData(player, "chat", "local") setElementData(player, "chat", "everyone") Edited March 22, 2024 by WWW
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