SA-MP Forums Archive
Get packet loss - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Get packet loss (/showthread.php?tid=618285)



Get packet loss - MerryDeer - 03.10.2016

Hi,

This function is good check for packet loss?

Код:
stock GetPlayerPacketloss(playerid,&Float:packetloss)
{
	/* Returns the packetloss percentage of the given playerid - Made by Fusez */

	if(!IsPlayerConnected(playerid)) return 0;

	new nstats[400+1], nstats_loss[20], start, end;
	GetPlayerNetworkStats(playerid, nstats, sizeof(nstats));

	start = strfind(nstats,"packetloss",true);
	end = strfind(nstats,"%",true,start);

	strmid(nstats_loss, nstats, start+12, end, sizeof(nstats_loss));
	packetloss = floatstr(nstats_loss);
	return 1;
}



Re: Get packet loss - Vince - 03.10.2016

Perhaps it used to be prior to 0.3z, when NetStats_PacketLossPercent was added. Research!