From 8ccaf47f6f8aee439d02065129f3db5054285506 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 27 Feb 2025 00:01:12 +0900 Subject: [PATCH] . --- exp_legacy/module/modules/addons/logging.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/exp_legacy/module/modules/addons/logging.lua b/exp_legacy/module/modules/addons/logging.lua index cbec212a..2e1f03f5 100644 --- a/exp_legacy/module/modules/addons/logging.lua +++ b/exp_legacy/module/modules/addons/logging.lua @@ -59,17 +59,21 @@ Event.add(defines.events.on_research_finished, function(event) end) Event.add(defines.events.on_player_joined_game, function(event) - if event and event.player_index then - add_log("[JOIN] " .. game.players[event.player_index].name .. " joined the game") + if not event or not event.player_index then + return end + + add_log("[JOIN] " .. game.players[event.player_index].name .. " joined the game") end) Event.add(defines.events.on_player_left_game, function(event) - if event and event.player_index then - if event.reason then - add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[event.reason]) - else - add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[defines.disconnect_reason.quit]) - end + if not event or not event.player_index then + return + end + + if event.reason then + add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[event.reason]) + else + add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[defines.disconnect_reason.quit]) end end)