Page 1 of 1

Ban Mod

PostPosted: Mon Jul 18, 2016 15:06
by octacian
Simple question. How do you do it? I'm new to tables, which is what I'd use (don't know how to insert and delete entries). Most importantly, how do you force the player to leave the game? ...And display a message when banned as well as when they try to log in?

Re: Ban Mod

PostPosted: Mon Jul 18, 2016 15:08
by BrandonReese
Ban Player function (pretty weak because it's IP based ban)
http://dev.minetest.net/minetest.ban_player

Kick player function, this is what you'll use to disconnect them with a message:
http://dev.minetest.net/minetest.kick_player

Re: Ban Mod

PostPosted: Mon Jul 18, 2016 15:16
by octacian
That's what I figured. How do I display a message when they try to log in? I'll look at xban or xban2 and see what it does, but if anyone knows that would be great.

Re: Ban Mod

PostPosted: Mon Jul 18, 2016 15:20
by BrandonReese
Kick would be used when you intially ban them. Then you can register a function for on_prejoinplayer (http://dev.minetest.net/minetest.regist ... joinplayer) then you can check the player name against your ban list and if they are banned just return a string in that function stating they are banned and returning the string will deny their access and show them the string you returned. If you don't return a string it lets them in.