I’m probably going to look like a nub for asking this, but

I am using a lua module that can block ran console commands.
(Making a cheat blocker on my server)
The code is something like

if CLIENT then
hook.Add( “OnConCommand”, “TestHook”, function ( cmd )
if ( string.find(cmd,“gm_test”) ) then
Msg(“Cheat detected. Blocked”)
return false;
end end) end
cmd is (obv) the command being ran, and gm_test is the command itself.

gm_test prints a message to the players chat and sets his health to 500.
When I enter into the console “gm_test” it blocks it, and it works.
But if I change the case in one of the letters, for example:
“Gm_test” or “gM_test” or “gm_Test”, the command works. And isn’t blocked.
Source engine will let the command run if you change the case in one or more of the letters, but the string find doesn’t detect it if you do.
Thus, allowing the command. :expressionless:

I looked at the wiki, and trying to get it to work I (literally)
Ended up not allowing (<any>) console commands to be ran and I ended up running around the map unable to disconnect >_> and had to end the hl2.exe.
(Epic fail)

So how can I get string find to detect the command in any case a player types? Without having to check if a player typed “Gm_test” or “GM_test” or “gM_teSt”

[lua]if ( string.find( string.lower(cmd), “gm_test” ) ) then[/lua]


didn’t work :expressionless:
I entered the command how it’s added, “gm_test” and it instead of blocking it, it worked. It works no matter how I type it now.

What module are you use?

it’s 1-5 in the thing in FP

Module name?

I don’t think it blocks any concommand.Add just the default ones in the console of gmod.


if string.lower(cmd) == “gm_test” then
return false
Should work.