diff options
-rw-r--r-- | README | 15 | ||||
-rw-r--r-- | depends.txt | 0 | ||||
-rw-r--r-- | init.lua | 29 |
3 files changed, 44 insertions, 0 deletions
@@ -0,0 +1,15 @@ +rkick: Restricted kick mod for Minetest +======================================= + +Privs: +rkick - Can kick players that do not have the rkick_immune priv +rkick_immune - Cannot be kicked with /rkick + +Command (just the one): +/rkick <player> - Kicks a player that does not have the rkick_immune priv (requires the rkick priv). The kick reason is fixed to "Kicked by %s", where "%s" is replaced by the name of the player that issued the command. + +Command Output: +"ERROR: You don't exist. Go away!" - The player that issued the command does not exist. Should never happen. +"ERROR: You did not specify a player, or the player you specified does not exist." - The player specified could not be found. +"You cannot kick %s.", where "%s" is replaced by a name - The player that you attempted to kick has the rkick_immune priv. +"Kicked %s", where "%s" is replaced by a name - The player specified was successfully kicked. diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/depends.txt diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..d69debb --- /dev/null +++ b/init.lua @@ -0,0 +1,29 @@ +minetest.register_privilege("rkick", { + description = "Can kick players without the rkick_immune priv.", + give_to_singleplayer = false +}) + +minetest.register_privilege("rkick_immune", { + description = "Cannot be kicked with rkick.", + give_to_singleplayer = false +}) + +minetest.register_chatcommand("rkick", { + params = "", + description = "Kick a player (restricted version)", + privs = {rkick=true}, + func = function(name, param) + if not minetest.get_player_by_name(name) then + return false, "ERROR: You don't exist. Go away!" + end + if not minetest.get_player_by_name(param) then + return false, "ERROR: You did not specify a player, or the player you specified does not exist." + end + if minetest.get_player_privs(param).rkick_immune then + return false, ("You cannot kick %s."):format(param) + else + minetest.kick_player(param, ("Kicked by %s"):format(name)) + return true, ("Kicked %s"):format(param) + end + end, +}) |