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

fivem-scripts
chat
commands
textchat
utility
#1

Hide Commands By FAXES

About
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 mis-spelled 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 theres a full server or something simular.

This was kind of requested here


In the Download

__resource.lua
sv_cmd.lua

Requirements
None this is a standalone script as with all my resources.


Downloads:
Both are on latest update


Change-log(s)
Click a version below to go to the update post.
1.0
1.1


Installation
Just like a basic resource

Further Support
If you have any issues, comments or suggestions please put them below. :mascot:

4 Likes

[Release] Proximity RPChat "Standalone Edition"
Block commands in chat typed wrong
[Solved] Help hiding misspelled commands
Failed Command
[Solved] Help hiding misspelled commands
#2

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

3 Likes

#3

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

#4

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

+1

2 Likes

#6

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

2 Likes

#7
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

#8

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

1 Like

#9

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

It will cancel every message

0 Likes

#10

Yep that’s why I made it :stuck_out_tongue:

1 Like

#11

It only removes commands. Not everything

1 Like

#12

@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

#13

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

1 Like

#14

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.)

0 Likes

#15

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

#16

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

#17

Appreciate the quick fix @FAXES :wink:

Totally forgot about the RegisterCommand function, thanks :slight_smile:

1 Like

#18

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

0 Likes

#19

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

2 Likes

#20

You’re right, thanks :slight_smile:

1 Like

#21

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.

0 Likes