1
0
Fork 0

Reorganize some commands

This commit is contained in:
Wuzzy 2018-01-30 03:33:30 +01:00
parent c22a5cba43
commit ca987e1255
1 changed files with 16 additions and 12 deletions

View File

@ -8,7 +8,7 @@ else
end end
local function handle_kill_command(suspect, victim) local function handle_kill_command(suspect, victim)
if minetest.settings:get_bool("damage_enabled") == false then if minetest.settings:get_bool("enable_damage") == false then
return false, S("Players can't be killed right now, damage has been disabled.") return false, S("Players can't be killed right now, damage has been disabled.")
end end
local victimref = minetest.get_player_by_name(victim) local victimref = minetest.get_player_by_name(victim)
@ -35,19 +35,19 @@ local function handle_kill_command(suspect, victim)
return true return true
end end
minetest.register_privilege("kill", { if not minetest.registered_privileges["player"] then
description = S("Can use /kill"), minetest.register_privilege("player", {
description = S("Can change player attributes"),
give_to_singleplayer = false, give_to_singleplayer = false,
}) })
minetest.register_privilege("announce", { end
description = S("Can use /say"), if minetest.registered_chatcommands["kill"] then
give_to_singleplayer = false, minetest.unregister_chatcommand("kill")
}) end
minetest.register_chatcommand("kill", { minetest.register_chatcommand("kill", {
params = S("[<name>]"), params = S("[<name>]"),
description = S("Kill player"), description = S("Kill player or yourself"),
privs = {kill=true}, privs = {player=true},
func = function(name, param) func = function(name, param)
if(param == "") then if(param == "") then
-- Selfkill -- Selfkill
@ -58,6 +58,10 @@ minetest.register_chatcommand("kill", {
end, end,
}) })
minetest.register_privilege("announce", {
description = S("Can use /say"),
give_to_singleplayer = false,
})
minetest.register_chatcommand("say", { minetest.register_chatcommand("say", {
params = S("<message>"), params = S("<message>"),
description = S("Send a message to every player"), description = S("Send a message to every player"),