From 386be9fb14e4fa03b914612f3db07da835607dc5 Mon Sep 17 00:00:00 2001 From: Elkien3 Date: Thu, 19 Oct 2017 08:16:02 -0500 Subject: [PATCH] Fix ctf scrolling with lag, a player was able to scroll past the max, which cause the server to crash,should be fixed now. (hard to debug locally, with no lag) --- mods/ctf_pvp_engine/ctf/gui.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mods/ctf_pvp_engine/ctf/gui.lua b/mods/ctf_pvp_engine/ctf/gui.lua index dc2b07a..67d0e61 100644 --- a/mods/ctf_pvp_engine/ctf/gui.lua +++ b/mods/ctf_pvp_engine/ctf/gui.lua @@ -317,17 +317,19 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) cur_team = tname end if fields.scroll_up then - scroll_diplomacy = scroll_diplomacy - 1 - if scroll_diplomacy < 0 then + if scroll_diplomacy > 0 then + scroll_diplomacy = scroll_diplomacy - 1 + else scroll_diplomacy = 0 - end + end ctf.gui.show(name, "diplo", cur_team) end if fields.scroll_down then - scroll_diplomacy = scroll_diplomacy + 1 - if scroll_diplomacy > (scroll_max+5) then + if scroll_diplomacy < (scroll_max+5) then + scroll_diplomacy = scroll_diplomacy + 1 + else scroll_diplomacy = scroll_max - end + end ctf.gui.show(name, "diplo", cur_team) end