diff --git a/ctf/teams.lua b/ctf/teams.lua index 6301163..30a2903 100644 --- a/ctf/teams.lua +++ b/ctf/teams.lua @@ -1,5 +1,8 @@ -- Get or add a team function ctf.team(name) + if name == nil then + return nil + end if type(name) == "table" then if not name.add_team then ctf.error("team", "Invalid table given to ctf.team") diff --git a/ctf_chat/init.lua b/ctf_chat/init.lua index 9baeb97..85d743d 100644 --- a/ctf_chat/init.lua +++ b/ctf_chat/init.lua @@ -251,13 +251,13 @@ minetest.register_chatcommand("t", { return end - if ctf.player(name).team then - local team = ctf.team(ctf.player(name).team) - if team then - for username, to in pairs(team.players) do - minetest.chat_send_player(username, - "<" .. name .. "> ** " .. param .. " **") - end + local tname = ctf.player(name).team + local team = ctf.team(tname) + if team then + minetest.log("action", tname .. "<" .. name .. "> ** ".. param .. " **") + for username, to in pairs(team.players) do + minetest.chat_send_player(username, + tname .. "<" .. name .. "> ** " .. param .. " **") end else minetest.chat_send_player(name,