• 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!

TFS 1.X+ anti idle, no work, tfs 1;5 7.72

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
926
Solutions
7
Reaction score
127
Location
Brazil
YouTube
caruniawikibr
kickIdlePlayerAfterMinutes = 15

hello, my anti idle doesn't work, I tested it here and the character doesn't log off, in config.lua it's like this.
 
normal player
Post automatically merged:

i found on my source

Lua:
void Player::setNextActionTask(SchedulerTask* task, bool resetIdleTime /*= true */)
{
    if (actionTaskEvent != 0) {
        g_scheduler.stopEvent(actionTaskEvent);
        actionTaskEvent = 0;
    }

    if (task) {
        actionTaskEvent = g_scheduler.addEvent(task);
        if (resetIdleTime) {
            this->resetIdleTime();
        }
    }
}

uint32_t Player::getNextActionTime() const
{
    return std::max<int64_t>(SCHEDULER_MINTICKS, nextAction - OTSYS_TIME());
}

void Player::onThink(uint32_t interval)
{
    Creature::onThink(interval);

    sendPing();

    MessageBufferTicks += interval;
    if (MessageBufferTicks >= 1500) {
        MessageBufferTicks = 0;
        addMessageBuffer();
    }

    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) {
            client->sendTextMessage(TextMessage(MESSAGE_STATUS_WARNING, fmt::format("There was no variation in your behaviour for {:d} minutes. You will be disconnected in one minute if there is no change in your actions until then.", kickAfterMinutes)));
        }
    }

    if (g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) {
        checkSkullTicks(interval / 1000);
    }

    /*addOfflineTrainingTime(interval);
    if (lastStatsTrainingTime != getOfflineTrainingTime() / 60 / 1000) {
        sendStats();
    }*/
}
 
Last edited:
normal player
Post automatically merged:

i found on my source

Lua:
void Player::setNextActionTask(SchedulerTask* task, bool resetIdleTime /*= true */)
{
    if (actionTaskEvent != 0) {
        g_scheduler.stopEvent(actionTaskEvent);
        actionTaskEvent = 0;
    }

    if (task) {
        actionTaskEvent = g_scheduler.addEvent(task);
        if (resetIdleTime) {
            this->resetIdleTime();
        }
    }
}

uint32_t Player::getNextActionTime() const
{
    return std::max<int64_t>(SCHEDULER_MINTICKS, nextAction - OTSYS_TIME());
}

void Player::onThink(uint32_t interval)
{
    Creature::onThink(interval);

    sendPing();

    MessageBufferTicks += interval;
    if (MessageBufferTicks >= 1500) {
        MessageBufferTicks = 0;
        addMessageBuffer();
    }

    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) {
            client->sendTextMessage(TextMessage(MESSAGE_STATUS_WARNING, fmt::format("There was no variation in your behaviour for {:d} minutes. You will be disconnected in one minute if there is no change in your actions until then.", kickAfterMinutes)));
        }
    }

    if (g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) {
        checkSkullTicks(interval / 1000);
    }

    /*addOfflineTrainingTime(interval);
    if (lastStatsTrainingTime != getOfflineTrainingTime() / 60 / 1000) {
        sendStats();
    }*/
}
If it's a normal player, it can't be on the GM account
 
Back
Top