mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
Made requested changes
This commit is contained in:
@@ -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
|
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
|
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
|
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
|
||||||
}
|
}
|
||||||
@@ -76,3 +76,6 @@ get-mead-2= Skål!
|
|||||||
get-beer-1= 🍺 Pouring A Glass 🍺
|
get-beer-1= 🍺 Pouring A Glass 🍺
|
||||||
get-beer-2= 🍻 Chears Mate 🍻
|
get-beer-2= 🍻 Chears Mate 🍻
|
||||||
verify=Please return to our discord and type r!verify __1__
|
verify=Please return to our discord and type r!verify __1__
|
||||||
|
|
||||||
|
[afk-kick]
|
||||||
|
message=All players were kicked because everyone was AFK.
|
||||||
@@ -18,14 +18,14 @@ Global.register(primitives, function(tbl)
|
|||||||
primitives = tbl
|
primitives = tbl
|
||||||
end)
|
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 =
|
local kick_player =
|
||||||
Async.register(function(player)
|
Async.register(function(player)
|
||||||
if game.tick - primitives.last_active < config.kick_time then return end -- Safety Catch
|
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)
|
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()
|
Event.on_nth_tick(config.update_time, function()
|
||||||
-- Check for active players
|
-- Check for active players
|
||||||
for _, player in ipairs(game.connected_players) do
|
for _, player in ipairs(game.connected_players) do
|
||||||
@@ -50,7 +50,7 @@ Event.on_nth_tick(config.update_time, function()
|
|||||||
player.gui.screen.add{
|
player.gui.screen.add{
|
||||||
type = 'frame',
|
type = 'frame',
|
||||||
name = 'afk-kick',
|
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) }
|
}.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
|
-- Kick the player, some delay needed because network delay
|
||||||
|
|||||||
Reference in New Issue
Block a user