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.
Add this right underneath.
In configmanager.h look for this.
Add this right underneath.
In luascript.cpp look for this.
Add this right underneath.
In player.cpp look for this.
Replace that code with this.
Place this anywhere in config.lua
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
In configmanager.cpp look for.
Code:
boolean[CLASSIC_EQUIPMENT_SLOTS] = getGlobalBoolean(L, "classicEquipmentSlots", false);
Code:
boolean[STAY_ONLINE_FOREVER] = getGlobalBoolean(L, "stayOnlineForever", false);
In configmanager.h look for this.
Code:
CLASSIC_EQUIPMENT_SLOTS,
Code:
STAY_ONLINE_FOREVER,
In luascript.cpp look for this.
Code:
registerEnumIn("configKeys", ConfigManager::CLASSIC_EQUIPMENT_SLOTS)
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()));
}
}
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
*/