[Tutorial] Disabling Player Chat-Input & Other Features

This only removes player’s ‘typing into chat’, and doesn’t override any scripts.

  1. Go to your internal server files (cfx-server-data) and locate chat:cl_chat.lua.
  2. Comment out line 20 & 143.
19. 
20. -- RegisterNetEvent('_chat:messageEntered')
21. 
...
142. else
143.     -- TriggerServerEvent('_chat:messageEntered', GetPlayerName(id), { r, g, b }, data.message, data.mode)
144. end
  1. F8 → refresh; ensure chat or restart your FXServer.
  2. Try the alternative method.
exports.chat:registerMessageHook(function(source, message, cbs)
     cbs.cancel()
end)

Remove Join/Leave Messages

  1. Go to your internal server files (cfx-server-data) and locate chat:sv_chat.lua.
  2. Comment out line 229 & 237.
228. 
229. -- TriggerClientEvent('chatMessage', -1, '', { 255, 255, 255 }, '^2* ' .. GetPlayerName(source) .. ' joined.')
238. end)
...
236. 
237. -- TriggerClientEvent('chatMessage', -1, '', { 255, 255, 255 }, '^2* ' .. GetPlayerName(source) ..' left (' .. reason .. ')')
238. end)
  1. F8 → refresh; ensure chat or restart your FXServer.
  2. Try the alternative method.
set chat_showJoins false
set chat_showQuits false

Remove “/say” Command

  1. Go to your internal server files (cfx-server-data) and locate chat:sv_chat.lua.
  2. Comment out lines 240-242.
240. -- RegisterCommand('say', function(source, args, rawCommand)
241.    -- routeMessage(source, (source == 0) and 'console' or GetPlayerName(source), rawCommand:sub(5), nil, true)
242. -- end)
  1. F8 → refresh; ensure chat or restart your FXServer.

Recommendation: If you’re planning on creating a chat theme, do not edit the chat source code! Use the gta online theme example provided by Cfx.re and edit it from there. Also ensure that it starts after chat.

ensure ...
ensure chat
ensure chat-theme
ensure ...
1 Like

Going to put this here: “Modifying or rewriting existing resources in this repository for local use only is strongly discouraged” . Edit the chat resource at your own expense. This is my way solving the issue and has proved effective thus far.

Source code for these files can be found here.

Hello, if you want to hide join / quit messages, you can put this in your server.cfg:

set chat_showJoins false
set chat_showQuits false

To prevent chat messages (and keep commands), you can add this server side in one of your resources:

exports.chat:registerMessageHook(function(source, message, cbs)
     cbs.cancel()
end)

Source: How To - Make Command Only Chat - #5 by CritteR


As said in cfx-server-data policy, it is better to not edit these resources :slight_smile:

1 Like

Both of our ways work, thanks for sharing. Always good to have the best information out there. :+1:

thanks for sharing, it is useful