• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Feature Stay Online Forever for 1.2

592160

Banned User
Joined
Oct 20, 2016
Messages
158
Reaction score
44
I made this so I didn't have to deal with worrying about setting a time frame in miliseconds before players are kicked.

In configmanager.cpp look for.
Code:
boolean[CLASSIC_EQUIPMENT_SLOTS] = getGlobalBoolean(L, "classicEquipmentSlots", false);
Add this right underneath.
Code:
boolean[STAY_ONLINE_FOREVER] = getGlobalBoolean(L, "stayOnlineForever", false);

In configmanager.h look for this.
Code:
CLASSIC_EQUIPMENT_SLOTS,
Add this right underneath.
Code:
STAY_ONLINE_FOREVER,

In luascript.cpp look for this.
Code:
registerEnumIn("configKeys", ConfigManager::CLASSIC_EQUIPMENT_SLOTS)
Add this right underneath.
Code:
registerEnumIn("configKeys", ConfigManager::STAY_ONLINE_FOREVER)

In player.cpp look for this.
Code:
    if (!getTile()->hasFlag(TILESTATE_NOLOGOUT) && !isAccessPlayer()) {
        idleTime += interval;
        const int32_t kickAfterMinutes = g_config.getNumber(ConfigManager::KICK_AFTER_MINUTES);
        if (idleTime > (kickAfterMinutes * 60000) + 60000) {
            kickPlayer(true);
        } else if (client && idleTime == 60000 * kickAfterMinutes) {
            std::ostringstream ss;
            ss << "You have been idle for " << kickAfterMinutes << " minutes. You will be disconnected in one minute if you are still idle then.";
            client->sendTextMessage(TextMessage(MESSAGE_STATUS_WARNING, ss.str()));
        }
    }
Replace that code with this.
Code:
    bool stayOnlineForever  = g_config.getBoolean(ConfigManager::STAY_ONLINE_FOREVER);
    if (!stayOnlineForever) {
        if (!getTile()->hasFlag(TILESTATE_NOLOGOUT) && !isAccessPlayer()) {
            idleTime += interval;
            const int32_t kickAfterMinutes = g_config.getNumber(ConfigManager::KICK_AFTER_MINUTES);
            if (idleTime > (kickAfterMinutes * 60000) + 60000) {
                kickPlayer(true);
            } else if (client && idleTime == 60000 * kickAfterMinutes) {
                std::ostringstream ss;
                ss << "You have been idle for " << kickAfterMinutes << " minutes. You will be disconnected in one minute if you are still idle then.";
                client->sendTextMessage(TextMessage(MESSAGE_STATUS_WARNING, ss.str()));
            }
        }
    }

Place this anywhere in config.lua
Code:
stayOnlineForever = true

It is important to note that you should place comments above any changes you make to the sources, also never delete code if you are replacing it, always create a copy of the original and place it in a block or inline comment
Code:
// this is an inline comment

/*
    This is a block comment
    These comments are ignored by the compiler
*/
 
There is no possibility take a ban in otlist? Like spoofing?
I've tried this code on TFS 1.2 and have x logged many times of the (otclient/regular) client. The player does not stay logged in so there should be no reason for a server to get banned for spoofing.
 
Back
Top