Jump to content

[Help] Autokick lagger user


Recommended Posts

Posted

Hi guys

Is it possible to kick a player who exceeds a certain amount of latency? can someone help me to search funtions in mangos core for extract the "milliseconds of latency" for someone client and do periodic check?

Thx

Posted

If you're on Unix :

grep "latency" mangos/src

You'll find everything you want, especially this :

pPlayer->GetSession()->GetLatency();

So I suggest a simple timer in WorldSession::Update such as :

if (m_latencyCheckTimer < diff)
{
   if (GetLatency() > 500 /*replace it by whatever you want*/)
   {
       KickPlayer();
       m_latencyCheckTimer = 1 * MINUTE * IN_MILLISECONDS;
   }
} else m_latencyCheckTimer = 1 * MINUTE * IN_MILLISECONDS;

Very basic, but you can improve it if you want (take values from conf, write something about the kicked player in logs, etc) ;)

Edit : actually my code is really bad, since a player could have a huge lag for 2 or 3 secs and be kicked just because the check would occur during those 2 or 3 secs.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use