Disallow transfer of stats if source and destination are same (#554)

This commit is contained in:
MinetestSam 2020-01-06 15:05:40 +05:30 committed by ANAND
parent 05fba3f5ce
commit f955ac8916

View file

@ -183,6 +183,9 @@ minetest.register_chatcommand("transfer_rankings", {
if not ctf_stats.players[dest] then if not ctf_stats.players[dest] then
return false, "Player '" .. dest .. "' does not exist." return false, "Player '" .. dest .. "' does not exist."
end end
if src == dest then
return false, "Source name and destination name cannot be the same!"
end
ctf_stats.players[dest] = ctf_stats.players[src] ctf_stats.players[dest] = ctf_stats.players[src]
ctf_stats.players[src] = nil ctf_stats.players[src] = nil