From cbf2cfa5a69493ddc26059dfec4e80f690c11e43 Mon Sep 17 00:00:00 2001 From: cheapie Date: Wed, 30 Jul 2014 00:19:06 -0500 Subject: Initial commit --- README | 15 +++++++++++++++ depends.txt | 0 init.lua | 29 +++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 README create mode 100644 depends.txt create mode 100644 init.lua diff --git a/README b/README new file mode 100644 index 0000000..62e942a --- /dev/null +++ b/README @@ -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 - 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 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, +}) -- cgit v1.2.3