From 22fe44732be580315fed19e5a032cc2eb54003d1 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Tue, 16 Nov 2021 23:13:36 +0100 Subject: [PATCH] scrap towny - fix desync --- modules/scrap_towny_ffa/team.lua | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/scrap_towny_ffa/team.lua b/modules/scrap_towny_ffa/team.lua index 52a5f0f3..b120cb8d 100644 --- a/modules/scrap_towny_ffa/team.lua +++ b/modules/scrap_towny_ffa/team.lua @@ -43,27 +43,30 @@ local function is_towny(force) end function Public.has_key(player) - local ffatable = Table.get_table() - if player == nil then - return false + if not (player and player.valid) then + return end - return ffatable.key[player] + local ffatable = Table.get_table() + + return ffatable.key[player.index] end function Public.give_key(player) - local ffatable = Table.get_table() - if player == nil then + if not (player and player.valid) then return end - ffatable.key[player] = true + local ffatable = Table.get_table() + + ffatable.key[player.index] = true end function Public.remove_key(player) - local ffatable = Table.get_table() - if player == nil then + if not (player and player.valid) then return end - ffatable.key[player] = false + local ffatable = Table.get_table() + + ffatable.key[player.index] = false end function Public.set_player_color(player)