Disable kick voting with a setting
This commit is contained in:
parent
7166571497
commit
08bc2ab8a2
77
init.lua
77
init.lua
@ -275,41 +275,44 @@ minetest.register_chatcommand("abstain", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_chatcommand("vote_kick", {
|
local set = minetest.setting_get("vote.kick_vote")
|
||||||
privs = {
|
if set == nil or minetest.is_yes(set) then
|
||||||
interact = true
|
minetest.register_chatcommand("vote_kick", {
|
||||||
},
|
privs = {
|
||||||
func = function(name, param)
|
interact = true
|
||||||
if not minetest.get_player_by_name(param) then
|
},
|
||||||
minetest.chat_send_player(name, "There is no player called '" ..
|
func = function(name, param)
|
||||||
param .. "'")
|
if not minetest.get_player_by_name(param) then
|
||||||
return
|
minetest.chat_send_player(name, "There is no player called '" ..
|
||||||
end
|
param .. "'")
|
||||||
|
return
|
||||||
vote.new_vote(name, {
|
|
||||||
description = "Kick " .. param,
|
|
||||||
help = "/yes, /no or /abstain",
|
|
||||||
name = param,
|
|
||||||
duration = 60,
|
|
||||||
perc_needed = 0.8,
|
|
||||||
|
|
||||||
on_result = function(self, result, results)
|
|
||||||
if result == "yes" then
|
|
||||||
minetest.chat_send_all("Vote passed, " ..
|
|
||||||
#results.yes .. " to " .. #results.no .. ", " ..
|
|
||||||
self.name .. " will be kicked.")
|
|
||||||
minetest.kick_player(self.name, "The vote to kick you passed")
|
|
||||||
else
|
|
||||||
minetest.chat_send_all("Vote failed, " ..
|
|
||||||
#results.yes .. " to " .. #results.no .. ", " ..
|
|
||||||
self.name .. " remains ingame.")
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_vote = function(self, name, value)
|
|
||||||
minetest.chat_send_all(name .. " voted " .. value .. " to '" ..
|
|
||||||
self.description .. "'")
|
|
||||||
end
|
end
|
||||||
})
|
|
||||||
end
|
vote.new_vote(name, {
|
||||||
})
|
description = "Kick " .. param,
|
||||||
|
help = "/yes, /no or /abstain",
|
||||||
|
name = param,
|
||||||
|
duration = 60,
|
||||||
|
perc_needed = 0.8,
|
||||||
|
|
||||||
|
on_result = function(self, result, results)
|
||||||
|
if result == "yes" then
|
||||||
|
minetest.chat_send_all("Vote passed, " ..
|
||||||
|
#results.yes .. " to " .. #results.no .. ", " ..
|
||||||
|
self.name .. " will be kicked.")
|
||||||
|
minetest.kick_player(self.name, "The vote to kick you passed")
|
||||||
|
else
|
||||||
|
minetest.chat_send_all("Vote failed, " ..
|
||||||
|
#results.yes .. " to " .. #results.no .. ", " ..
|
||||||
|
self.name .. " remains ingame.")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_vote = function(self, name, value)
|
||||||
|
minetest.chat_send_all(name .. " voted " .. value .. " to '" ..
|
||||||
|
self.description .. "'")
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user