fixed /plist not working

This commit is contained in:
kaadmy 2015-10-02 16:13:36 -07:00
parent 4e3f2f281d
commit 46a302107c

View File

@ -55,13 +55,13 @@ minetest.register_chatcommand(
{ {
params = "[all|recent]", params = "[all|recent]",
description = "List players that are connected and have connected since the last server restart", description = "List players that are connected and have connected since the last server restart",
func = function(name, param) func = function(player_name, param)
local time = minetest.get_gametime() local time = minetest.get_gametime()
local str = "" local str = ""
if param == "all" then if param == "all" then
minetest.chat_send_player(name, "Players:") minetest.chat_send_player(player_name, "Players:")
elseif param == "recent" then elseif param == "recent" then
str = str .. "Recent players: " str = str .. "Recent players: "
else else
@ -75,9 +75,9 @@ minetest.register_chatcommand(
if param == "all" then if param == "all" then
if plyr ~= nil then if plyr ~= nil then
player_count = player_count + 1 player_count = player_count + 1
minetest.chat_send_player(name, " " .. name .. ": connected for " .. prettytime(time - jointime)) minetest.chat_send_player(player_name, " " .. name .. ": connected for " .. prettytime(time - jointime))
else else
minetest.chat_send_player(name, " " .. name .. ": last seen " .. prettytime(time - jointime) .. " ago") minetest.chat_send_player(player_name, " " .. name .. ": last seen " .. prettytime(time - jointime) .. " ago")
end end
else else
if param == "recent" then if param == "recent" then
@ -92,12 +92,12 @@ minetest.register_chatcommand(
end end
end end
minetest.chat_send_player(name, str) minetest.chat_send_player(player_name, str)
if param == "recent" then if param == "recent" then
minetest.chat_send_player(name, player_count .. " recent players") minetest.chat_send_player(player_name, player_count .. " recent players")
else else
minetest.chat_send_player(name, player_count .. " connected players") minetest.chat_send_player(player_name, player_count .. " connected players")
end end
end end
}) })