ai-chat
Chat with channels (local, OOC, job), command suggestions and /me. Stands in for FiveM's chat resource.
ai-chat is the chat box. Players write in channels you set in the panel (everyone, the players nearby, one job), run commands with suggestions for only the commands they may use, and show actions over their head with /me.
What it does in the game
- Channels. Each channel has a name, a colour and a range: everyone on the server, or only the players within some metres. A channel can be limited to jobs and gangs. Players see only the channels they may use.
- Switching. Tab moves through the channels (and the Command mode, below). The chat opens in the first channel.
- Commands. A line starting with
/runs a command in any channel. Suggestions list only the commands the player is allowed to use, with their arguments. - Commands without / (optional): the input opens in a Command mode where the command is typed without the slash.
- History. Up and Down walk through the lines you sent, while the input is empty.
- Colours. GTA colour codes
^0to^9work. HTML from scripts is never drawn. - Fading. The chat fades out a few seconds after the last message while it is closed.
- Author names are character names.
- Messages are not stored. They go to the log channel
messagesthrough AI Core.
Installation
The AI Core txAdmin recipe installs it. By hand: put the folder in resources/[ai]/ and add ensure ai-chat to server.cfg after ensure ai-core. It needs ai-core. It has no database table.
Remove FiveM's own chat resource and keep set resources_useSystemChat false in your cfg: ai-chat provides chat.
Panel settings
Open the admin panel (F10) and pick Chat.
Channels tab
Where players write. Each channel is one record; press New channel to add one.
| Setting | What it changes | Values | Default for a new channel |
|---|---|---|---|
| Name | The channel tag shown before the author. | 1 to 24 characters | |
| Colour | Colour of the channel tag and the author, as #RRGGBB. | a hex colour | #36ff9f |
| Range | Only players this close to the writer read it. 0 means everyone on the server. | 0 to 1000 m | 0 |
| Jobs | Only members of these jobs can use it. Leave jobs and gangs empty for everyone. | job names | empty |
| Gangs | Members of these gangs can use it too. | gang names | empty |
| Only on duty | Job members must be on duty in that job. | on / off | off |
| Order | Lower comes first; the first channel is where the chat opens. | 0 to 100 | 10 |
Channels shipped with the script:
| Channel | Range | Who | Order |
|---|---|---|---|
| Local | 20 m | everyone | 0 |
| OOC | everyone on the server | everyone | 1 |
| Police | everyone on the server | the police job | 2 |
Settings tab
Messages: rules for every message.
| Setting | What it changes | Values | Default |
|---|---|---|---|
| Longest message | Longer messages are cut. | 16 to 1000 characters | 256 |
| Stays on screen | Seconds the messages stay visible after a new one while the chat is closed. | 2 to 60 s | 8 |
| Messages kept | How many messages each player keeps to scroll back. | 20 to 500 | 100 |
| Join and leave messages | Tells everyone when a player joins or leaves. | on / off | off |
| Commands without / | The input opens in Command mode: players type a command without the slash. Tab moves through Command and the channels; a line starting with / still runs as a command in any channel. | on / off | on |
Commands
| Command | Arguments | Who | What it does |
|---|---|---|---|
/ooc | <message> | everyone | An out of character line (OOC | <FiveM name>) to you and the players within 20 m. |
/me | <message> | everyone | Shows an action over your head ("lights a cigarette") for 7 seconds, to you and the players within 20 m. Up to 120 characters. |
Keybinds
| Default key | What it does | Name in GTA settings |
|---|---|---|
| T | Opens the chat input | Open the chat |
Inside the open chat: Tab switches the channel, Up / Down walk the sent lines or the suggestions, Enter sends (or takes the picked suggestion), Escape closes.
Works with other scripts
- Stands in for FiveM's
chatresource (provide 'chat'). Every script that sendschat:addMessage,chatMessage, adds suggestions or callsexports.chat:addMessageworks unchanged. - Commands made with AI Core's lib (
addCommand) send their own help and arguments as suggestions.
Known limits
chat:addTemplateis ignored and HTML templates are not drawn: the message shows its plain text.- Scripts that listen to FiveM's internal
_chat:messageEnteredevent see nothing. Use thechatMessageserver event instead. - Message hooks'
setSeObjectand ACE filtering of script modes are not answered.