Respond on failed /team requests

This commit is contained in:
rubenwardy 2016-03-31 18:52:48 +01:00
parent 5731eba276
commit 1cfb4ae8ef

View File

@ -36,7 +36,7 @@ minetest.register_chatcommand("team", {
local l_name = string.match(param, "^removeplr ([%a%d_-]+)")
if create then
local privs = minetest.get_player_privs(name)
if privs and privs.ctf_admin == true then
if privs and privs.ctf_admin then
if (
string.match(create, "([%a%b_]-)")
and create ~= ""
@ -52,7 +52,7 @@ minetest.register_chatcommand("team", {
end
elseif remove then
local privs = minetest.get_player_privs(name)
if privs and privs.ctf_admin == true then
if privs and privs.ctf_admin then
if ctf.remove_team(remove) then
return true, "Removed team '" .. remove .. "'"
else
@ -68,7 +68,7 @@ minetest.register_chatcommand("team", {
local count = 0
for _, value in pairs(ctf.team(param).players) do
count = count + 1
if value.auth == true then
if value.auth then
minetest.chat_send_player(name, count .. ">> " .. value.name
.. " (team owner)")
else
@ -92,7 +92,7 @@ minetest.register_chatcommand("team", {
end
elseif j_name and j_tname then
local privs = minetest.get_player_privs(name)
if privs and privs.ctf_team_mgr == true then
if privs and privs.ctf_team_mgr then
if ctf.join(j_name, j_tname, true, name) then
return true, "Successfully added " .. j_name .. " to " .. j_tname
else
@ -103,7 +103,7 @@ minetest.register_chatcommand("team", {
end
elseif l_name then
local privs = minetest.get_player_privs(name)
if privs and privs.ctf_team_mgr == true then
if privs and privs.ctf_team_mgr then
if ctf.remove_player(l_name) then
return true, "Removed player " .. l_name
else
@ -119,17 +119,23 @@ minetest.register_chatcommand("team", {
minetest.chat_send_player(name, "'"..param.."' is an invalid parameter to /team")
team_console_help(name)
end
if (
ctf and
if ctf.setting("gui") then
if (ctf and
ctf.players and
ctf.players[name] and
ctf.players[name].team and
ctf.setting("gui")
) then
ctf.players[name].team) then
print("showing")
ctf.gui.show(name)
return true, "Showing the team window"
else
return false, "You're not part of a team!"
end
else
return false, "GUI is disabled!"
end
end
end,
return false, "Nothing could be done"
end
})
minetest.register_chatcommand("join", {