NetStats_PacketLossPercent() - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP (
https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (
https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: NetStats_PacketLossPercent() (
/showthread.php?tid=538339)
NetStats_PacketLossPercent() -
Pottus - 21.09.2014
I was testing this function to implement a packetloss kicker and found it to be completely unreliable here is the code.
pawn Код:
#include <YSI\y_hooks>
#define PACKET_LOSS_DELAY 60000
#define PACKET_LOSS_INFRACTIONS 3
static Float:LastPacketLoss[MAX_PLAYERS];
static PacketLossTime[MAX_PLAYERS];
static PacketLossInfractions[MAX_PLAYERS];
hook OnGameModeInit()
{
SetTimer("LossChecker", 1000, true);
return 1;
}
hook OnPlayerConnect(playerid)
{
LastPacketLoss[playerid] = 0.0;
PacketLossTime[playerid] = GetTickCount();
PacketLossInfractions[playerid] = 0;
return 1;
}
LossChecker();
public LossChecker()
{
new Float:loss;
foreach(new i : Player)
{
loss = NetStats_PacketLossPercent(i);
// Loss detected
if(loss > LastPacketLoss[i])
{
if(GetTickCount() - PacketLossTime[i] > PACKET_LOSS_DELAY) PacketLossInfractions[i] = 1;
else PacketLossInfractions[i]++;
PacketLossTime[i] = GetTickCount();
if(PacketLossInfractions[i] == PACKET_LOSS_INFRACTIONS)
{
Disconnect_Reason[i] = DISCONNECT_PACKETLOSS;
DelayKick(i);
}
}
LastPacketLoss[i] = loss;
}
return 1;
}
Re: NetStats_PacketLossPercent() -
n0minal - 21.09.2014
Hey Pottus i saw it on Wiki: This function has been found to be currently unreliable the output is not as expected when compared to the client. Therefore this function should not be used as a packet loss kicker.
Re: NetStats_PacketLossPercent() -
Tamer - 21.09.2014
Quote:
Originally Posted by n0minal
Hey Pottus i saw it on Wiki: This function has been found to be currently unreliable the output is not as expected when compared to the client. Therefore this function should not be used as a packet loss kicker.
|
That was added there at a very recent day I guess.
The function is indeed unreliable. I've seen players with %15.0 of packetloss and their gameplay was pretty good.
Re: NetStats_PacketLossPercent() -
Pottus - 21.09.2014
I put that on the Wiki lol.
Re: NetStats_PacketLossPercent() -
Whitetiger - 21.09.2014
It's always seemed reliable for me. someone can have a net spike and lose all packets for a certain time then their internet goes back to normal. explaining a 15% total packetloss but normal gameplay afterward.
Re: NetStats_PacketLossPercent() -
rymax99 - 21.09.2014
Yep - same experience here, I made a thread about a month ago. It never goes back to normal once it slightly jumps, even with a perfect connection to the server (~30ms latency and 9 hops to the server) the function randomly shows 15% packetloss.