Fix and improve /reset_rankings

This commit is contained in:
ClobberXD 2018-12-03 21:59:12 +05:30 committed by rubenwardy
parent e865091a5a
commit 5bb2cff6c5

View file

@ -329,14 +329,25 @@ minetest.register_chatcommand("reset_rankings", {
local reset_name = param == "" and name or param local reset_name = param == "" and name or param
if not ctf_stats.players[reset_name] then
return false, "Player '" .. reset_name .. "' does not exist."
end
if reset_name == name and not reset_y[name] then if reset_name == name and not reset_y[name] then
reset_y[name] = true reset_y[name] = true
return true, "This will reset your stats and rankings completely. You will lose access to any special privileges such as the team chest or userlimit skip. This is irreversable. If you're sure, type /reset_rankings again to perform the reset" minetest.after(30, function()
reset_y[name] = nil
end)
return true, "This will reset your stats and rankings completely."
.. " You will lose access to any special privileges such as the"
.. " team chest or userlimit skip. This is irreversable. If you're"
.. " sure, re-type /reset_rankings within 30 seconds to reset."
end end
reset_y[name] = nil reset_y[name] = nil
ctf_stats.players[name] = nil ctf_stats.players[reset_name] = nil
ctf_stats.player(reset_name) ctf_stats.player(reset_name)
ctf.needs_save = true
return true, "Successfully reset the stats and ranking of " .. reset_name return true, "Successfully reset the stats and ranking of " .. reset_name
end end
}) })