add 'cheat-commands' rule

This commit is contained in:
MihailRis
2024-11-06 18:01:00 +03:00
parent 2e24d60404
commit 5e9b290aea
3 changed files with 37 additions and 5 deletions
+16
View File
@@ -52,6 +52,22 @@ function submit(text)
add_to_history(text)
setup_variables()
text = text:trim()
local name
for s in text:gmatch("%S+") do
name = s
break
end
if name == nil then
name = text
end
if not rules.get("cheat-commands") and table.has(console.cheats, name) then
console.log("cheat commands are disabled")
document.prompt.text = ""
document.prompt.focused = true
return
end
document.log.caret = -1
local status, result = pcall(console.execute, text)
if result then