This is my first public resource in a long time so please bare with.
Under your OnStart module in C# you need to use the following to start a command handler.
Alt.OnClient("chatmessage", ChatExtension.OnChatMessage);
This pushes the message the player types to the ChatExtension.cs file.
If you wish to send a message to the players chat box, you can use the following.
You can set the SENDER
field to null
or as a string for a sender. Message is also a string.
player.Emit("chatmessage", "SENDER", "MESSAGE");
To set a message's color (Unable to for sender yet), you need to use the following:
player.Emit("chatmessage", "[INFO]", "{FDFE8B}" + message);
This would send a white [INFO] with yellow message string
To stop input onto the chat you can send the following event to the player.
alt.onServer('toggleChat', (state) => {
hidden = state;
});