Other attemps to fix crashes/bugs.
parent
028274d1d1
commit
0e8da112bf
10
pvp.lua
10
pvp.lua
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue