Hi, I am making a script which will use the removal of someone’s chat message. How would I go about it? Currently, the only way I know to remove messages in chat would be to just restart the chat resources but this isn’t a feasible solution.
Look at the chat resources GitHub there’s a couple things there. Or I could do a script for ya??
I want to learn, thats the point of this. Its a simple script I’m trying to create.
Where do I find the github?
the citizenFX GitHub has it. let me find and link it.
https://github.com/citizenfx/cfx-server-data/blob/master/resources/[system]/chat/sv_chat.lua
Line 7 : RegisterServerEvent('chat:clear')
this could be what your looking for?
I saw that. Wouldn’t that clear the whole chat rather than one from a specified sender? Heres what I’m trying to do:
I want to make a chat-filter type thing. I Have a .txt or lua file where users can input words they deem “inapropriate” and if someone sends such message, it will remove it and execute a specefied action eg: kick or ban them.
~~ I really want to try to figure this out, please don’t just hand it to me. Thanks!
Anyone see any other feasible solutions? At this point I’m thinking of rewriting the chat script so before it posts the message it checks the database.
You can cancel a chatMessage
event using CancelEvent
, which will stop the message from being routed to other players.
Doesn’t work all the time because the PR for the chat resource isn’t implemented yet iirc.
You want to help me? Make a “Chat Clear” command script where it clears chat