• 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+ Anty-MC in sources.

OTcreator

Active Member
Joined
Feb 14, 2022
Messages
425
Solutions
1
Reaction score
44
Hi!
Is it possible to change in sources so that before logging in, the client throws out a message that they already have the maximum number of characters logged in on a given IP?
I found something like this, but for (TFS 1.0/1.1/1.2):

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->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();
 
Solution
Paste here
C++:
int32_t ipsCounter = 0;
for (const auto& it : g_game.getPlayers())
{
    if (player->getIP() == it.second->lastIP && ++ipsCounter >= 4)
    {
        disconnectClient("You can only login 4 characters per IP, and you reached the limit.");
        return;
    }
}
Paste here
C++:
int32_t ipsCounter = 0;
for (const auto& it : g_game.getPlayers())
{
    if (player->getIP() == it.second->lastIP && ++ipsCounter >= 4)
    {
        disconnectClient("You can only login 4 characters per IP, and you reached the limit.");
        return;
    }
}
 
Solution
Paste here
C++:
int32_t ipsCounter = 0;
for (const auto& it : g_game.getPlayers())
{
    if (player->getIP() == it.second->lastIP && ++ipsCounter >= 4)
    {
        disconnectClient("You can only login 4 characters per IP, and you reached the limit.");
        return;
    }
}

Will it work with TFS 1.4.2 ?
Will it solve the problem of using Exit ?

In creaturescript in the onLogin function at exit there was no re-login which allowed players to relog quickly having IP=0 (during exit).
That way they could have MC Max.
 
Yes, it solves that issue as we are parsing last IP stored from players, not the current one.
 
Back
Top