AI Core

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 ^0 to ^9 work. 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 messages through 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.

SettingWhat it changesValuesDefault for a new channel
NameThe channel tag shown before the author.1 to 24 characters
ColourColour of the channel tag and the author, as #RRGGBB.a hex colour#36ff9f
RangeOnly players this close to the writer read it. 0 means everyone on the server.0 to 1000 m0
JobsOnly members of these jobs can use it. Leave jobs and gangs empty for everyone.job namesempty
GangsMembers of these gangs can use it too.gang namesempty
Only on dutyJob members must be on duty in that job.on / offoff
OrderLower comes first; the first channel is where the chat opens.0 to 10010

Channels shipped with the script:

ChannelRangeWhoOrder
Local20 meveryone0
OOCeveryone on the servereveryone1
Policeeveryone on the serverthe police job2

Settings tab

Messages: rules for every message.

SettingWhat it changesValuesDefault
Longest messageLonger messages are cut.16 to 1000 characters256
Stays on screenSeconds the messages stay visible after a new one while the chat is closed.2 to 60 s8
Messages keptHow many messages each player keeps to scroll back.20 to 500100
Join and leave messagesTells everyone when a player joins or leaves.on / offoff
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 / offon

Commands

CommandArgumentsWhoWhat it does
/ooc<message>everyoneAn out of character line (OOC | <FiveM name>) to you and the players within 20 m.
/me<message>everyoneShows 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 keyWhat it doesName in GTA settings
TOpens the chat inputOpen 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 chat resource (provide 'chat'). Every script that sends chat:addMessage, chatMessage, adds suggestions or calls exports.chat:addMessage works unchanged.
  • Commands made with AI Core's lib (addCommand) send their own help and arguments as suggestions.

Known limits

  • chat:addTemplate is ignored and HTML templates are not drawn: the message shows its plain text.
  • Scripts that listen to FiveM's internal _chat:messageEntered event see nothing. Use the chatMessage server event instead.
  • Message hooks' setSeObject and ACE filtering of script modes are not answered.

On this page