Hey.
I’ve made a /comms command for chat. I would like it to show the text I/other people enter, when it doesn’t. There are no script errors that show in F8, or in chat.
Is there any way I can show my entered text in the chat after typing /comms?
Ie:
/comms test.
It would show:
Central Comms (USER: Aussie Baguette) test.
Finally, is there any way to make it show a User ID rather than an in-game name?
ie:
Central Comms (ID: ***) test.
Stop using this outdated way of “listening” for commands and use RegisterCommand instead.
You’re triggering the “chatMessage” event from inside the “chatMessage” event handler in a loop-like manner, and with 4 parameters, when the “chatMessage” event was declared 4 lines above having 3 parameters…
CancelEvent() at the end of the control flow of the event/function doesn’t make sense since it will already finish when it gets there?
RegisterCommand("comms", function(command, args, raw)
local message = table.concat(args, " ")
local id = 1 -- Get the id from wherever..
TriggerEvent('chat:addMessage', {
color = {255, 0, 0},
multiline = true,
args = {"^4Central Comms (^1ID: ^0" .. id .. "^4) ^0" .. message}
})
end)
Sorry about all of the messages, just found the quote function.
Nothing appears in chat with that above script. Any idea what might be causing it? No script errors, or anything.