(I'm new to these forums, so I apologize if I posted in wrong category)
Hello,
I've been looking at the documentation for the past hour and can't seem to find anything that could be used to disable or edit the chat/command/console ("/" key).
Is this possible or is it currently past the possibilities of the engine?
Thanks!
Disabling chat?
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: Disabling chat?
Restrict all server commands to server admins only:
Disable chatting ("/me" inclusive) entirely -> same as /revoke <player> shout
Untested code.
Code: Select all
local priv_required = "server
for cmd, def in pairs(minetest.registered_chatcommands) do
def.privs[priv_required] = true
end
Code: Select all
minetest.register_on_joinplayer(function(player)
local auth = minetest.get_auth_handler()
local player_name = player:get_player_name()
local player_auth = auth.get_auth(player_name)
player_auth.privileges.shout = nil
auth.set_privileges(player_name, player_auth.privileges)
end)
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
-
- Member
- Posts: 167
- Joined: Mon May 22, 2017 20:27
Re: Disabling chat?
You're missing a quote at the end of the first line so this will fail with a syntax error. Also you'd need to make sure that this code runs after all the commands have been registered, so ideally after all other mods have loaded (minetest really still needs a way to do this elegantly...). Not to mention that you should probably be using minetest.override_chatcommand.Krock wrote:Restrict all server commands to server admins only:Code: Select all
local priv_required = "server for cmd, def in pairs(minetest.registered_chatcommands) do def.privs[priv_required] = true end
The other snippets looks good to me though (although I'm not familiar with the authentication API so I might be missing something).
Who is online
Users browsing this forum: No registered users and 5 guests