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

:fax: Hide Commands :fax:

Created by: FAXES


Hello, guys, I’m back with another script. This is a very simple script but I hope it can help you out :slight_smile:. This script deletes any misspelled or unknown commands from displaying in chat like:

to displaying nothing. All commands will still work if executed, this is to remove the /help’s when there’s a full server or something similar.

This was kind of requested here


Download:

If you have any issues or comments please put them below :mascot:

12 Likes

I would recommend using RegisterCommand(‘cmd’, function() for commands, it fixes all these issues.

3 Likes

Yes totally agree, but its also good for servers that don’t have a /help but people always spam /help when it does not exist…

1 Like

@FAXES I believe this release performs it’s function and purpose perfectly.

+1

2 Likes

You can just edit the chat script. But I guess this script would be convienent for NOOBS.

2 Likes
AddEventHandler('chatMessage', function(Source, Name, Msg)
    args = stringsplit(Msg, " ")
    CancelEvent()
    if string.find(args[1], "/") then
        local cmd = args[1]
        table.remove(args, 1)
    end
end)

wtf am I reading? Why split the string? Why cancel the event without checking if it starts with a “/” (wouldn’'t this stop all messages)? Why are you storing the first argument in a variable which is never used? Why are you removing the first argument?

2 Likes

thank you for the wonderful script FAXES props to you for helping me and my community out

1 Like

I was about to write the same, this script seems to be pure nonsense…

It will cancel every message

Yep that’s why I made it :stuck_out_tongue:

1 Like

It only removes commands. Not everything

1 Like

@FAXES

It does cancel out everything. I tried it on my server, but people could no longer use the chat, unless using an actual working command (/ooc, /me, /say etc.).

1 Like

Thanks for the report I’ll have a look into it…

1 Like

Great!

Since you are looking into it anyways, could you also add a little error message when someone types an unknown/mis-spelled command? Something like: “Unknown command. Are you sure you typed the command correctly?”.

Maybe an extra challenge, for you, or someone else, maybe have a feature/resource which would ‘disable capitalization on commands’. So let’s say a player types /RESPAWN instead of /respawn, and that the command will still work. (sorry if there is already a resource out there for this, couldn’t find it.)

Well for the capitalisation you can do that in a script already by using the RegisterCommand function. To memory this will send the command as a lowercase it this is used for each command.

For the error message I’ll look into that.

2 Likes

Update 1.1

  • Fixed the issue of any chat output not working, Its been fixed thanks to @ItsLeandro for confirming for me.

  • Report back any other errors.

1 Like

Appreciate the quick fix @FAXES :wink:

Totally forgot about the RegisterCommand function, thanks :slight_smile:

1 Like

Just when I thought it was working the way it should, it doesn’t unfortunately.

When I use the Chat Roles plugin by JayJay ([Release] Chat Roles [UPDATED 5/30/18] [Tutorial Released]) your resource will duplicate the messages.

Here a screenshot:
Knipsel

I think the roles resource has the hide commands within it.

2 Likes

You’re right, thanks :slight_smile:

1 Like

If anyone is having this issue, using the police script rank titles, I removed these lines

else
	TriggerClientEvent('chatMessage', -1, Name, { 255, 255, 255 }, Msg)
end

Line 8, 9 and 10 sv_cmd.lua

Works for me on my server.