SA-MP Forums Archive
Packet Loss detecter - 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: Packet Loss detecter (/showthread.php?tid=358562)



Packet Loss detecter - S1avaK - 10.07.2012

hello. Is it possible to define a Packet Loss? If so, how?


Re: Packet Loss detecter - S1avaK - 10.07.2012

Hmm.. But here - 78.129.221.58:7784 - is available Packet Loss detecter and it works!


Re: Packet Loss detecter - Mauzen - 10.07.2012

GetPlayerNetworkStats contains packetloss. you just need to parse it out of the string


Re: Packet Loss detecter - S1avaK - 10.07.2012

Maybe.. But I do not have a precise definition. It suffices to define the event as a true / false. Maybe you know how to do it?


Re: Packet Loss detecter - coole210 - 11.07.2012

Quote:
Originally Posted by S1avaK
Посмотреть сообщение
Maybe.. But I do not have a precise definition. It suffices to define the event as a true / false. Maybe you know how to do it?
Read the wiki for GetPlayerNetworkStats, it should be easy enough to understand and make it yourself.


Re: Packet Loss detecter - S1avaK - 11.07.2012

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
GetPlayerNetworkStats contains packetloss. you just need to parse it out of the string
How? Can you give an example of code?


Re: Packet Loss detecter - Mauzen - 11.07.2012

Код:
Network Active: 1
Network State: 8
Messages in Send buffer: 0
Messages sent: 46
Bytes sent: 1944
Acks sent: 12
Acks in send buffer: 0
Messages waiting for ack: 0
Messages resent: 0
Bytes resent: 0
Packetloss: 0.0
Messages received: 57
Bytes received: 1524
Acks received: 0
Duplicate acks received: 0
Inst. KBits per second: 28.8
KBits per second sent: 2.2
KBits per second received: 1.7
Example output
You can use e.g. sscanf, regex or strfind to parse the interesting data out of it


Re: Packet Loss detecter - 2191penna2191 - 11.07.2012

How to export the packetloss pls bro help me.


Re: Packet Loss detecter - Mauzen - 11.07.2012

pawn Код:
new str[350];
GetPlayerNetworkStats(0, str, 350);
new start = strfind(str, "Packetloss", false);
strmid(str, str, start + 12, strfind(str, "Messages", false, start) - 2);
new Float:packetloss = floatstr(str);
No testing on your own=no learning but ok.
This should do it. Dont know what values packetloss will have, either 0-100 or 0.0-1.0 i guess.


Re: Packet Loss detecter - 2191penna2191 - 12.07.2012

I'll test it thank you.