Make the default chat say OOC with server ID?

Basically is there anyway to make it so when you type in chat without any commands it would show something like:

OOC | (name) (id): (message)

or even just

(name) (id): (message)

I have tried having a look in the sv_chat.lua but cant seem to change anything without getting some type of bug.

For example I tried changing line 187:

TriggerEvent('chatMessage', source, #outMessage.args > 1 and outMessage.args[1] or '', outMessage.args[#outMessage.args])

Since this is what seems to change it but I kept getting bugs where it was saying things like:

(id) : (name)
OOC | (name) : (id)

If anyone could help me figure this out it would be great.

You can probably take a look at this and modify it, I know @Jaaybops_Media has done something similar

Is this a replacement for the chat resource, if so I am just looking to keep the regular chat but just to edit it a little.

1 Like

It’s based on the original chat resource. Check it out and read the ReadMe etc

Thank you for the suggestion but I do not like the design of the chat in my opinion.

Do you mind showing the entire command in its working state? If so I could probably help you with it

Yeah I tried editing the other lines but they didn’t seem to work but I probably did something wrong.

TriggerEvent('chatMessage', source, #outMessage.args > 1 and outMessage.args[1] or '', outMessage.args[#outMessage.args])

    if not WasEventCanceled() then
        if type(routingTarget) ~= 'table' then
            TriggerClientEvent('chat:addMessage', routingTarget, outMessage)
        else
            for _, id in ipairs(routingTarget) do
                TriggerClientEvent('chat:addMessage', id, outMessage)
            end
        end
    end

    if not fromConsole then
        print(author .. '^7' .. (modes[mode] and (' (' .. modes[mode].displayName .. ')') or '') .. ': ' .. message .. '^7')
    end
end

It can be changed, but no problem.

Do you know how it can be done?

bump.

Basically, you have global, local and staff, you can just change local to OOC and global to RP.

bump

I have found a chat resource that uses this code (some things I have added):

AddEventHandler('_chat:messageEntered', function(author, color, message)
    if not message or not author then
        return
    end

    TriggerEvent('chatMessage', source, author, message)

    if not WasEventCanceled() then
        TriggerClientEvent('chatMessage', -1, "OOC | " .. author, { 128, 128, 128 }, message)
    end

    print(author .. '(' .. source .. ')', '^7: ' .. message .. '^7')
end)

However I believe this can solve my issue but I can’t seem to make it work. When the message gets printed it shows the server ID but when I type in chat it still shows:

Name: (msg)

I have tried adding '(' .. source .. ')', to this line:

TriggerClientEvent('chatMessage', -1, "OOC | " .. author, { 128, 128, 128 }, message)

But still nothing, if anyone knows the correct way to display serverID please let me know. Also If anyone knows my the "OOC | " is not working either please let me know.

1 Like