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

C++ kickAfterMinutes

alcapone

Member
Joined
Jan 13, 2021
Messages
247
Reaction score
19
C++:
    if (!getTile()->hasFlag(TILESTATE_NOLOGOUT) && !isAccessPlayer() && !isExerciseTraining()) {
        idleTime += interval;
        const int32_t kickAfterMinutes = g_configManager().getNumber(KICK_AFTER_MINUTES);
        if (idleTime > (kickAfterMinutes * 60000) + 60000) {
            removePlayer(true);
        } else if (client && idleTime == 60000 * kickAfterMinutes) {
            std::ostringstream ss;
            ss << "There was no variation in your behaviour for " << kickAfterMinutes << " minutes. You will be disconnected in one minute if there is no change in your actions until then.";
            client->sendTextMessage(TextMessage(MESSAGE_ADMINISTRADOR, ss.str()));
        }
    }


I would like that if the player is attacking a monster the time does not count
if (!getTile()->hasFlag(TILESTATE_NOLOGOUT) && !isAccessPlayer() && !isExerciseTraining()) {
 
You would need to set/remove storage upon attack and have it auto remove every 2 seconds (duration of attacks) so that way you can tell if the player is still training or not.
EDIT: (May be better to set it to 60 seconds, this way the system isnt constantly setting the storage again/clearing it every 2 seconds.. with lots of players this could cause issues. So set it for 60 seconds, continue to check every 10 seconds if the player has the storage or not and you should be good to go.)

So in theory, create a creaturescript for the monster that registers this storage; then use the storage in the script above.
Code:
player->getStorage(12345, value);

Code:
 if (!getTile()->hasFlag(TILESTATE_NOLOGOUT) && !isAccessPlayer() && !player->getStorage(12345, value)) {

I am not sure if you have an ExerciseTraining function that checks, but if so - then what you are presenting should work.
 
Last edited:
Back
Top