changed kick message and increase afk time to 45 minutes
parent
23d4ade140
commit
e4c5a652ba
11
init.lua
11
init.lua
|
@ -7,9 +7,9 @@ to this software to the public domain worldwide. This software is
|
|||
distributed without any warranty.
|
||||
]]
|
||||
|
||||
local MAX_INACTIVE_TIME = 300
|
||||
local CHECK_INTERVAL = 1
|
||||
local WARN_TIME = 20
|
||||
local MAX_INACTIVE_TIME = 2700
|
||||
local CHECK_INTERVAL = 10
|
||||
local WARN_TIME = 10
|
||||
|
||||
local players = {}
|
||||
local checkTimer = 0
|
||||
|
@ -45,12 +45,13 @@ minetest.register_globalstep(function(dtime)
|
|||
|
||||
--Kick player if he/she has been inactive for longer than MAX_INACTIVE_TIME seconds
|
||||
if players[playerName]["lastAction"] + MAX_INACTIVE_TIME < currGameTime then
|
||||
minetest.kick_player(playerName, "Kicked for inactivity")
|
||||
minetest.kick_player(playerName, "The Server has kicked you for inactivity to save your life!")
|
||||
core.chat_send_all("# Illuna: " .. playerName .. "'s avatar is doing something else now, because its master is not here.")
|
||||
end
|
||||
|
||||
--Warn player if he/she has less than WARN_TIME seconds to move or be kicked
|
||||
if players[playerName]["lastAction"] + MAX_INACTIVE_TIME - WARN_TIME < currGameTime then
|
||||
minetest.chat_send_player(playerName, "Warning, you have " .. tostring(players[playerName]["lastAction"] + MAX_INACTIVE_TIME - currGameTime) .. " seconds to move or be kicked")
|
||||
minetest.chat_send_player(playerName, "# Illuna: **Warning**, you have " .. tostring(players[playerName]["lastAction"] + MAX_INACTIVE_TIME - currGameTime) .. " seconds to move or the server will kick you for inactivity")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue