Jump to content

[help] onChatMessage does not work at all


Recommended Posts

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 by Turbe$Z
Link to comment

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 by WWW
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...