Turbe$Z Posted March 22 Share Posted March 22 (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 by Turbe$Z Link to comment
WWW Posted March 22 Share Posted March 22 We have this event on client. https://wiki.multitheftauto.com/wiki/OnClientChatMessage 1 Link to comment
Turbe$Z Posted March 22 Author Share Posted March 22 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? Link to comment
WWW Posted March 22 Share Posted March 22 You have to select the message, then cancel the event. Link to comment
Turbe$Z Posted March 22 Author Share Posted March 22 3 minutes ago, WWW said: You have to select the message, then cancel the event. what do you mean? Link to comment
WWW Posted March 22 Share Posted March 22 (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 by WWW 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