Other attemps to fix crashes/bugs.

master
upsilon 2017-05-25 18:33:53 +02:00
parent 028274d1d1
commit 0e8da112bf
No known key found for this signature in database
GPG Key ID: A80DAE1F266E1C3C
2 changed files with 6 additions and 8 deletions

10
pvp.lua
View File

@ -5,6 +5,9 @@ local pvptable = {}
pvpplus = {}
function pvpplus.pvp_set(player_name, state)
if pvpplus.is_playing_tournament(player_name) then
return false, "PvP state cannot be changed while playing a tournament."
end
if type(state) ~= "boolean" then
return false, "The state parameter has to be a boolean."
end
@ -82,12 +85,7 @@ if minetest.get_modpath("unified_inventory") then
type = "image",
image = "pvp.png",
action = function(player)
local player_name = player:get_player_name()
if pvpplus.is_playing_tournament(player_name) then
minetest.chat_send_player(player_name, "PvP state cannot be changed while playing a tournament.")
else
pvpplus.pvp_toggle(player_name)
end
pvpplus.pvp_toggle(player_name)
end
})
end

View File

@ -60,8 +60,8 @@ function pvpplus.get_score(name)
if not pvpplus.is_running_tournament() then
return false, "There is no running tournament."
end
if not pvpplus.is_playing_tournament(name) then
return false, "Player " .. name .. "is not currently playing a tournament."
if not pvpplus.sent_damages[name] then
return false, "Player " .. name .. " did not play in the current tournament."
end
return tournament.sent_damages[name] - tournament.received_damages[name] + tournament.kills[name] * 20
end