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

Anti-mc - freeze server

metiu11

Member
Joined
Mar 26, 2011
Messages
94
Solutions
2
Reaction score
5
Heyo again :D TFS 0.3.6
I found script like this - anti MC
It works but this script kicked player when he log MC and freeze server like 1-2 sec.
Do you have an idea how to block login and send information to the player in the client when choosing a character?
I am pretty sure to just change "doRemoveCreature(p.pid)" in another but i dont know what function can do that...
Code:
local config = {
        max = 1,
        text = "Multi-Client or Magebomb is not allowed.",
        group_id = 1  -- it will only kick player whit that id (1=Players, 2=tutor, 3=seniortutors, 4=Gm's, 5=Cm's and 6=God's
}

local accepted_ip_list = ""  -- here put the Ips you want to be allowed to use Mc/Magebomb..

local function antiMC(p)
        if #getPlayersByIp(getPlayerIp(p.pid)) >= p.max then
                doRemoveCreature(p.pid)
        end
        return TRUE
end

function onLogin(cid)
        if getPlayerGroupId(cid) <= config.group_id then
                if isInArray(accepted_ip_list,getPlayerIp(cid)) == FALSE then
                        addEvent(antiMC, 1000, {pid = cid, max = config.max+1})
                        doPlayerPopupFYI(cid, config.text)
                end
        end
        return TRUE
end
 
Heyo again :D TFS 0.3.6
I found script like this - anti MC
It works but this script kicked player when he log MC and freeze server like 1-2 sec.
Do you have an idea how to block login and send information to the player in the client when choosing a character?
I am pretty sure to just change "doRemoveCreature(p.pid)" in another but i dont know what function can do that...
Code:
local config = {
        max = 1,
        text = "Multi-Client or Magebomb is not allowed.",
        group_id = 1  -- it will only kick player whit that id (1=Players, 2=tutor, 3=seniortutors, 4=Gm's, 5=Cm's and 6=God's
}

local accepted_ip_list = ""  -- here put the Ips you want to be allowed to use Mc/Magebomb..

local function antiMC(p)
        if #getPlayersByIp(getPlayerIp(p.pid)) >= p.max then
                doRemoveCreature(p.pid)
        end
        return TRUE
end

function onLogin(cid)
        if getPlayerGroupId(cid) <= config.group_id then
                if isInArray(accepted_ip_list,getPlayerIp(cid)) == FALSE then
                        addEvent(antiMC, 1000, {pid = cid, max = config.max+1})
                        doPlayerPopupFYI(cid, config.text)
                end
        end
        return TRUE
end


yes

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

To this:
Code:
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();

protocolstatus.cpp (TFS 1.0/1.1/1.2)

gunz script: Very important - Rules change on otservlist.org (https://otland.net/threads/very-important-rules-change-on-otservlist-org.247531/post-2407794)
 
@chupaescadatri tried now and dont worked... :( Script kick MC not giving info to him "u cannot login with MC". Kick freezing server
yes but only a tip, player to log off and log in and give a freeze, it's mysql and hd error
my one gave the same error, formatted the pc put in a clean HD and optimized the max_allowed_packet to 25mb
in hd ssd and stopped
 
@chupaescadatri Well, now i used my own computer to test this server, dont have hosting now. I have SSD, 16 GB ram, i5 3.2 ghz, GTX 970. So i think its enough to host 2 players. Its weird... Where can i optimize the max_allowed_packet? I thinking if i block people before they login this freeze will disappeared
 
@chupaescadatri i have hosting, tried to change it with mysql anyway i have similar 25mb now and this freeze still being... Now i see that problem is when someone log in or log off, just freeze server 2-3 sec... can u help me with this?
 
Okay i got new informations. :D
First... Its not the problem with this script, its problem with my database.
Second... I open local database with xampp, then test it and its works good, dont have freeze.
I currently use hosting only for the database. The server is enabled on my private computer and we use hamachi. It seems that connecting to the database every time someone tries to log on to the server takes a long time. Can it be the fault of hosting on a private computer? If I move to a dedicated server, will the problem disappear?
 
Well if someone know what happend... Its a problem with connection. When im using database in another hosting than server i got freezing, because my server have to send a question to the another hosting. The question is sent for a few seconds, when ur player gets a level, skills etc. This server send questions, answers etc. so if u have database and server on the same hosting this problem will disappear.
 
Back
Top