• 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++ [AFK] Online people

rooyo

New Member
Joined
Jul 2, 2013
Messages
70
Reaction score
3
I need a script similar to this only under 0.3.6tfs
not to count people standing longer than 15 minutes as afk and people with more than 3 mc, not to get banned on otservlist
I wrote to the owner of the script from 1.3 but there is no contact with him

I pay for the service, of course






I added not counting afk players to gunz's version.
So with this you can have no logout zones or above 15 min kick time and still be within otservlist rules.
This also has gunz's not counting more than 4 mcs per IP.

protocolstatus.cpp (TFS 1.0/1.1/1.2) (1.3 Version available below)

Change:
C++:
players.append_attribute("online") = std::to_string(g_game.getPlayersOnline()).c_str();

to

C++:
uint32_t real = 0;

std::map<uint32_t, uint32_t> listIP;

for (const auto& it : g_game.getPlayers()) {
    if (it.second->getIdleTime() < 960000 && it.second->getIP() != 0) {
        auto ip = listIP.find(it.second->getIP());
        if (ip != listIP.end()) {
            listIP[it.second->getIP()]++;
            if (listIP[it.second->getIP()] < 5) {
                real++;
            }
        }
        else {
            listIP[it.second->getIP()] = 1;
            real++;
        }
    }
}
players.append_attribute("online") = std::to_string(real).c_str();

For TFS 1.3
protocolstatus.cpp

Change:
C++:
players.append_attribute("online") = std::to_string(g_game.getPlayersOnline()).c_str();

to

C++:
uint32_t real = 0;

std::map<uint32_t, uint32_t> listIP;

for (const auto& it : g_game.getPlayers()) {
    if (it.second->idleTime < 960000 && it.second->getIP() != 0) {
        auto ip = listIP.find(it.second->getIP());
        if (ip != listIP.end()) {
            listIP[it.second->getIP()]++;
            if (listIP[it.second->getIP()] < 5) {
                real++;
            }
        }
        else {
            listIP[it.second->getIP()] = 1;
            real++;
        }
    }
}
players.append_attribute("online") = std::to_string(real).c_str();

in player.h move

C++:
int32_t idleTime = 0;

from the private: section to below "public:" (up)
 
did u see the post comments?
cuz on the post is 1 for tfs 0.4 just check the differences
 

Similar threads

Back
Top