function saveDayOnlineTime() local info = db.getResult("SELECT `id`, `onlinet`, `onlinet_train` FROM `players` WHERE `onlinet` > 0;") if(info:getID() ~= -1) then local day_id = math.floor(os.time() / 86400) repeat db.executeQuery("INSERT INTO `player_onlinet` (`day_id`, `player_id`, `onlinet`, `onlinet_train`) VALUES (" .. day_id .. ", " .. info:getDataInt("id") .. ", " .. info:getDataInt("onlinet") .. ", " .. info:getDataInt("onlinet_train") .. ");") until not(info:next()) info:free() end return true end local tp_pos = {x=1128, y=1282, z=7} local allowed_ips = {} local players_limit = 4 function onThink(interval, lastExecution) local players = getPlayersOnline() for i, pid in ipairs(players) do local ip = getPlayerIp(pid) if(isInArray(allowed_ips, ip) ~= TRUE) then local players_sameip = getPlayersByIp(ip) if(#players_sameip > players_limit) then local player_pos = getCreaturePosition(pid) if(player_pos.x ~= tp_pos.x or player_pos.y ~= tp_pos.y or player_pos.z ~= tp_pos.z) then doTeleportThing(pid, {x=1128, y=1282, z=7}, TRUE) end doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE, "More then " .. players_limit .. " players logged from your IP. If you are not cheating (MC) message GOD/GM to unblock your IP.") end end end return TRUE end