[Release] Hide Commands - Hide mis-spelled commands in chat! [fax-hidecmds] [1.2]

You got any futher with the error message?

1 Like

The error was fixed. See the change-logs

I meant, is it possible for me to make a error message like: “That’s not a command”, as an answer for the client? :smiley:

Yes that is very possible there is actually a video on how to make that very bit of code. Ill try to find it for ya.

1 Like

You got the video?

Not work…

I have been trying to edit the script to make it send a message to the client if the command was wrong but it happens for every commands I type in even correct ones, any suggestions?

-- Made by FAXES.
--
AddEventHandler('chatMessage', function(Source, Name, Msg)
    args = stringsplit(Msg, " ")
    CancelEvent()
    if string.find(args[1], "/") then
        TriggerClientEvent('chatMessage', -1, "^7[^1System^7] Sorry That command doesn't exist, type /help to get a list of commands!")
        local cmd = args[1]
        table.remove(args, 1)
	else
		TriggerClientEvent('chatMessage', -1, Name, { 255, 255, 255 }, Msg)
	end
end)

function stringsplit(inputstr, sep)
    if sep == nil then
        sep = "%s"
    end
    local t={} ; i=1
    for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
        t[i] = str
        i = i + 1
    end
    return t
end

thanks

Why put in so much not needed code? This simple code will fix your problems:

AddEventHandler(‘es:invalidCommandHandler’, function(source, command_args, user)
CancelEvent()
TriggerClientEvent(‘chat:addMessage’, source, {
template = ’

System:
Invalid command!
’,
args = {}
})
end)

if you are not using civ-theme-chat then you can easily transfer it to the normal theme. (Assuming you have the knowledge to do so)

If you don’t want a message to show up but you just want to cancel the event then just use this code:

AddEventHandler(‘es:invalidCommandHandler’, function(source, command_args, user)
CancelEvent()
end)

Is there a more recent version of this resource? I like it very much and i need something that removes missspelled commands but when i add it to my server I get the chat resource time warning. Maybe it’s conflicting with my other chat resources i don’t know.

I’ve tried it, works perfectly fine. Something must be interfering with it.

Release - 1.2


  • Updated resource manifest.

how do i do the same when i dont event use the chat ressource but people spam console-commands?

1 Like

Not working anymore!

How do I remove unwanted commands all together? For example if you type “/r” in chat it gives a bunch of rateLimiter_ commands, Their pointless for users so how do I get rid of them?