SA-MP Forums Archive
Detecting desynced players - 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: Detecting desynced players (/showthread.php?tid=578321)



Detecting desynced players - IzadorO - 18.06.2015

Just wondering if anyone knows how to detect desynced players via scripting. What would need to be put into the script, etc? Like the desynced detection script on LS-RP.


Re: Detecting desynced players - rappy93 - 18.06.2015

I think you can use this function to detect if a player is desynced.

https://sampwiki.blast.hk/wiki/NetStats_PacketLossPercent


Re: Detecting desynced players - IzadorO - 18.06.2015

Yea I tried inputting packet loss, but I don't think that's what causes it, as I was trying it on myself - with over 1.0 packet_loss, yet I was still able to see server dialogs etc. I'm sure being desynced removes your ability to see dialogs - correct me if I'm wrong. I tried different packet_loss values, such as 0.5, 1.0, and eventually, 2.0 - I went to 2.0 for a minute, yet I could still see dialogs. Any other ideas?


Re: Detecting desynced players - Abagail - 18.06.2015

According to the wiki(though I have no idea how true this information is), the function isn't very accurate:


The wiki(though I also don't really have any information about this either) also suggests that this snippet HAS more accuracy:
pawn Код:
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;
}
(http://forum.sa-mp.com/showpost.php?...&postcount=984)

But to get to the point, it should be detected through packetloss, though the function may be at fault if your having trouble detecting it properly.


Re: Detecting desynced players - IzadorO - 18.06.2015

Alright. Thank you Abagail & rappy93. Gonna try to detect it correctly via the function itself and the snippet. If anyone has anything else that can help me correctly detect the desynced state, please feel free to post.


Re: Detecting desynced players - rappy93 - 18.06.2015

Good luck man.