From 4e9e2747fb5eb61e152aa178f786f1eed445e2b4 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 6 Apr 2021 22:58:10 +0100 Subject: [PATCH] Made requested changes --- config/afk_kick.lua | 2 +- locale/en/addons.cfg | 5 ++++- modules/addons/afk-kick.lua | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config/afk_kick.lua b/config/afk_kick.lua index 800b9730..d0be3e1b 100644 --- a/config/afk_kick.lua +++ b/config/afk_kick.lua @@ -5,5 +5,5 @@ return { afk_time = 3600*10, --- @setting afk_time The time in ticks that must pass for a player to be considered afk kick_time = 3600*30, --- @setting kick_time The time in ticks that must pass without any active players for all players to be kicked trust_time = 3600*60*10, --- @setting trust_time The time in ticks that a player must be online for to count as trusted - update_time = 3600*30, --- @setting update_time How often in ticks the script check for active players + update_time = 3600*30, --- @setting update_time How often in ticks the script checks for active players } \ No newline at end of file diff --git a/locale/en/addons.cfg b/locale/en/addons.cfg index 95defd53..af26b91a 100644 --- a/locale/en/addons.cfg +++ b/locale/en/addons.cfg @@ -75,4 +75,7 @@ get-mead-1= Filling the drinking horn get-mead-2= Skål! get-beer-1= 🍺 Pouring A Glass 🍺 get-beer-2= 🍻 Chears Mate 🍻 -verify=Please return to our discord and type r!verify __1__ \ No newline at end of file +verify=Please return to our discord and type r!verify __1__ + +[afk-kick] +message=All players were kicked because everyone was AFK. \ No newline at end of file diff --git a/modules/addons/afk-kick.lua b/modules/addons/afk-kick.lua index 578e57b8..9bea3b05 100644 --- a/modules/addons/afk-kick.lua +++ b/modules/addons/afk-kick.lua @@ -18,14 +18,14 @@ Global.register(primitives, function(tbl) primitives = tbl end) ---- Kicks an afk player, used to give to for gui to show +--- Kicks an afk player, used to add a delay so the gui has time to appear local kick_player = Async.register(function(player) if game.tick - primitives.last_active < config.kick_time then return end -- Safety Catch - game.kick_player(player, 'Afk while no active players on the server') + game.kick_player(player, 'AFK while no active players on the server') end) ---- Check for an active player every 5 minutes +--- Check for an active player every update_time number of ticks Event.on_nth_tick(config.update_time, function() -- Check for active players for _, player in ipairs(game.connected_players) do @@ -50,7 +50,7 @@ Event.on_nth_tick(config.update_time, function() player.gui.screen.add{ type = 'frame', name = 'afk-kick', - caption = 'All players were kicked because everyone was afk.', + caption = {'afk-kick.message'}, }.location = { x=res.width*(0.5 - 0.11*uis), y=res.height*(0.5 - 0.14*uis) } -- Kick the player, some delay needed because network delay