I am using the esx_rpchat, and I can do the /ooc to get a box for the message. Now, I want that same box to alss be the defaul message box. How do combine these two snippets into one working?
(esx_rpchat/server/main.lua) The Out-of-character message box:
RegisterCommand('ooc', function(source, args, rawCommand)
local playerName = GetPlayerName(source)
local msg = rawCommand:sub(5)
local name = getIdentity(source)
TriggerClientEvent('chat:addMessage', -1, {
template = '<div style="padding: 0.5vw; margin: 0.5vw; background-color: rgba(41, 41, 41, 0.6); border-radius: 3px;"><i class="fas fa-globe"></i> {0}:<br> {1}</div>',
args = { playerName, msg }
})
end, false)
and the default chat text that does not have any styling at all.
AddEventHandler('chatMessage', function(source, name, message)
if string.sub(message, 1, string.len("/")) ~= "/" then
local name = getIdentity(source)
TriggerClientEvent("sendProximityMessageMe", -1, source, name.firstname, message)
end
CancelEvent()
end)