Fix /rankings not returning text output

This commit is contained in:
Anand S 2018-11-12 20:45:55 +05:30 committed by rubenwardy
parent 9ac91d8ee1
commit d0ff9e332a

View file

@ -235,8 +235,8 @@ local function send_as_chat_result(to, name)
if place < 1 then if place < 1 then
place = #players + 1 place = #players + 1
end end
local you_are_in = (to == name) and "You are in " or name .. " is in " local you_are_in = (to == name) and "You are in " or name .. " is in "
local result = you_are_in .. place .. " place." local result = you_are_in .. place .. " place.\n"
if me then if me then
local kd = me.kills local kd = me.kills
if me.deaths > 1 then if me.deaths > 1 then
@ -245,10 +245,10 @@ local function send_as_chat_result(to, name)
result = result .. "Kills: " .. me.kills .. result = result .. "Kills: " .. me.kills ..
" | Deaths: " .. me.deaths .. " | Deaths: " .. me.deaths ..
" | K/D: " .. math.floor(kd * 10) / 10 .. " | K/D: " .. math.floor(kd * 10) / 10 ..
" | Bounty kills: " .. me.bounty_kills .. "\nBounty kills: " .. me.bounty_kills ..
" | Captures: " .. me.captures .. " | Captures: " .. me.captures ..
" | Attempts: " .. me.attempts .. " | Attempts: " .. me.attempts ..
" | Score: " .. math.floor(me.score) "\nScore: " .. math.floor(me.score)
end end
return true, result return true, result
end end
@ -270,7 +270,7 @@ minetest.register_chatcommand("rankings", {
end end
if not minetest.get_player_by_name(name) then if not minetest.get_player_by_name(name) then
send_as_chat_result(name, target) return send_as_chat_result(name, target)
else else
local players = {} local players = {}
for pname, pstat in pairs(ctf_stats.players) do for pname, pstat in pairs(ctf_stats.players) do