New Resources: chat 💬

As part of the ‘data rewrite’ project, various resources will be rewritten, updated or refactored. Among these resources is the chat resource.


The current chat resource was contributed by means of a GitHub pull request from a third-party contributor. It’s considered an essential feature to have, and the community has already implemented various ideas on top of the text chat concept.

Current state

The chat resource is in a fairly good shape at this point, given that it was practically completely rewritten within the last year. It has a few underdocumented and underutilized features (like chat templates), editing configuration is somewhat clunky, and people seem to prefer to work against rather than with the system, replacing the entire chat resource rather than providing proper API improvements.


As the resource probably will not have to be fully rewritten, we can go with an incremental set of improvements.


Both with competitive game types on FiveM becoming more popular, as well as with roleplay servers often having different channels implemented already, a channel switching system and/or multiple input modes would be a welcome addition to the chat system.

This could be implemented in a few ways:


The chat would have a single channel output, and multiple different input modes would be available by using different keys (and/or command prefixes).

This mostly matches the system used in GTA Online for team/global/organization chat, as well as various other games. If we decide to go this way, an API should be provided.


Even though this idea is pretty much at risk of scope creep and turning into a full-on messaging system, we could also implement a channel-based system in the chat resource. This would involve switchable tabs (either using mouse or perhaps keyboard input while focused?), a slightly larger chat window, and perhaps even support for direct messaging.

There have been a few games implementing such a system, however with larger slot counts and servers potentially making creative uses for this, this might actually be the way to go.


A feature of nearly any chat system dating back to the classical IRC clients is the ability to highlight a specific user. This could be neat to have in FiveM as well, combined with a function similar to MTA’s setWindowFlashing (and Windows notification API integration) and nickname completion.

Perhaps notifications could also target specific groups in a similar way to Discord, which would probably be implemented by means of targeting all players satisfying a specific ACE/parent principal.


It’s stupidly annoying to end up in a chat channel, see a conversation going on, and have no clue what was said before you joined. The chat system, therefore, should save at least some backlog in a server-side storage system, perhaps even across server restarts.

Also, it’s stupid to have your chat history disappear because some server is down, there’s administrative drama, or some other reason, so there should be a default (with big warnings not to disable them) to save logs in plain-text files on the client - a special native to append to log files should exist, with a quota at that to prevent abuse by servers that are out to fill your disk.

Perhaps even KVS could be used here to have some cross-server-though-same-resource data going on, however maintaining integrity against rogue servers would be an interesting question here.

External chat integration

It’s apparently pretty common for people to want to integrate their chat with the ability to use it out of the game - historically, echoing to IRC channels, but nowadays probably to services like Discord.

If we’re going with the ‘messenger-like’ solution of supporting channels and DMs, of course, it’d be really nice to have a much more expansive solution to message persistence that does not necessarily rely on (or, on the contrary, might integrate with) a third-party messaging service.

Third-party messengers

For now, we’ll assume everyone uses Discord, however an API for this should be modular to accommodate changes in the instant messaging ecosystem. This description, therefore, will also pretend we’re talking about Discord mainly.

Firstly, imagine proper two-way integration for sending messages to and from a single game channel/a channel on the external service. This would be attainable easily by implementing the Discord protocol directly as a resource, only requiring people to provide a token for a bot account - handling the WebSockets portion this way as well.

However, if we’re going the way of ‘multiple in-game channels’, this can of course be extended a lot further. Imagine a set of one-to-one mappings of channels both in-game and on a service like Discord, with the game actually retrieving backlogs from the third-party chat service, essentially making even anonymous in-game gamers a first-class citizen of the third-party IM service, at least as far as the API of this third-party service will allow.

In the case of Discord, if/when they finally open up usage of the full extent of the RPC API, this can be made even cooler by integrating with a local client’s account (though permissions for this will have to be handled on a really strict level), essentially making for an in-game IM client without too many compromises.


Simple: the chat log stream should return (probably as a websocket instead of SSE this time) in an authenticated form, and HTTP endpoints should be provided to send messages.

Web frontend

If we’re going to be an instant messenger for the most part, imagine how cool it’d be to have an integrated web frontend - of course, able to be configured and/or restricted, perhaps even allowing authentication with a third-party sign-in service from the web to link to a Steam ID/FiveM license token… :yum:


Imagine resources being able to sanely filter chat messages for locations, add prefixes to ‘geotag’ messages (tweet-style channels?) with in-game locations, and more, while using the game’s native input modes.

In fact, channels should even have the ability to have a default template set so people can pretend to be Twitter in a Twitter channel. This’d make for great :rp: scenarios!


Chat hiding should be implemented, through an API, with two resources to do this manually - one to do so through a hotkey, and another to do so through a command. Both should of course respect the current state set in the API by other resources.

Bug fixes

There’s some spoofing going on of player names. This shouldn’t be possible.

User/server styles

As it’s really common for people to customize the chat style in bad ways, there should be a better way of customizing the chat.

On the server, this should probably be done through a combination of client-replicated convars and resources to add new style sheets. An example should be provided, perhaps looking (in its basic form) like the GTAO chat with a different font (licenses and all) due to people like @Rox10 and @Warxander currently disabling the NUI text chat and enabling the original chat with all its text input/display issues.

On the client, perhaps, we should allow user styles (saved in KVS, maybe?) and possibly just embed a Monaco editor from the web (if internet connectivity is available) and have some kind of way to open this editor (and apply changes in real time? :open_mouth:)…


This stuff is super fancy, keep it up!


Original chat has better support for team chat/global chat, the main reason we use it. Plus it’s native how could you not love the look :heart_eyes:


Noice! Can’t wait!!!

Please, text highlighting so I can copy paste messages… Probably like one line of CSS too.

Very nice :smiley: :smiley:

Good job very cool =)

how would I post my custom made textchat in the fivem forums

1 Like

When you say custom, what is actually custom except the css?

EDIT: Old topic oof